on xenial help sign in
merge lp:~lukas-kde/unity8/miral
commitf1f0776c736a13568b3405a74cb964e049ba62c3 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 5 Dec 2016, 09:52 (10 years ago) parentbe7a7921173993
4 files changed+24−42
qml/Stage/Stage.qml+12−37 tests/mocks/Unity/Application/MirSurface.h+4 tests/mocks/Unity/Application/SurfaceManager.cpp+7−4 tests/qmltests/Stage/tst_DesktopStage.qml+1−1
qml/Stage/Stage.qml+12−37
@@ -879,13 +879,7 @@ FocusScope {
879879 } else if (model.window.state === Mir.MaximizedBottomRightState) {
880880 appDelegate.maximizeBottomRight();
881881 } else if (model.window.state === Mir.RestoredState) {
882− if (decoratedWindow.dragging) {
883− appDelegate.restore(false, WindowStateStorage.WindowStateNormal);
884− } else if (appDelegate.anyMaximized) {
885− appDelegate.restoreFromMaximized()
886− } else {
887− appDelegate.restore();
888− }
882+ appDelegate.restore();
889883 }
890884 }
891885 }
@@ -918,7 +912,6 @@ FocusScope {
918912 if (visuallyMaximized) {
919913 priv.updateForegroundMaximizedApp();
920914 }
921−
922915 }
923916
924917 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
@@ -982,10 +975,6 @@ FocusScope {
982975 animationsEnabled = (animated === undefined) || animated;
983976 windowState |= WindowStateStorage.WindowStateMinimized; // add the minimized bit
984977 }
985− function restoreFromMaximized(animated) {
986− animationsEnabled = (animated === undefined) || animated;
987− windowState = WindowStateStorage.WindowStateRestored;
988− }
989978 function restore(animated,state) {
990979 animationsEnabled = (animated === undefined) || animated;
991980 windowState = state || WindowStateStorage.WindowStateRestored;
@@ -1304,15 +1293,9 @@ FocusScope {
13041293 windowedY: restoredY;
13051294 }
13061295 },
1307− State {
1308− name: "semiMaximized"
1309− PropertyChanges { target: touchControls; enabled: true }
1310− PropertyChanges { target: resizeArea; enabled: true }
1311− PropertyChanges { target: decoratedWindow; shadowOpacity: .3 }
1312− },
13131296 State {
13141297 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
1315− extend: "semiMaximized"
1298+ extend: "normal"
13161299 PropertyChanges {
13171300 target: appDelegate
13181301 windowedX: root.leftMargin
@@ -1331,7 +1314,7 @@ FocusScope {
13311314 },
13321315 State {
13331316 name: "maximizedTopLeft"; when: appDelegate.maximizedTopLeft && !appDelegate.minimized
1334− extend: "semiMaximized"
1317+ extend: "normal"
13351318 PropertyChanges {
13361319 target: appDelegate
13371320 windowedX: root.leftMargin
@@ -1350,7 +1333,7 @@ FocusScope {
13501333 },
13511334 State {
13521335 name: "maximizedBottomLeft"; when: appDelegate.maximizedBottomLeft && !appDelegate.minimized
1353− extend: "semiMaximized"
1336+ extend: "normal"
13541337 PropertyChanges {
13551338 target: appDelegate
13561339 windowedX: root.leftMargin
@@ -1369,15 +1352,15 @@ FocusScope {
13691352 },
13701353 State {
13711354 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1372− extend: "semiMaximized"
1373− PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: windowedY;
1374− requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appDelegate.windowedHeight }
1355+ extend: "normal"
1356+ PropertyChanges { target: appDelegate; windowedX: root.leftMargin; windowedY: windowedY;
1357+ windowedWidth: appContainer.width - root.leftMargin; windowedHeight: windowedHeight }
13751358 },
13761359 State {
13771360 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1378− extend: "semiMaximized"
1379− PropertyChanges { target: appDelegate; requestedX: windowedX; requestedY: PanelState.panelHeight;
1380− requestedWidth: appDelegate.windowedWidth; requestedHeight: appContainer.height - PanelState.panelHeight }
1361+ extend: "normal"
1362+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1363+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
13811364 },
13821365 State {
13831366 name: "minimized"; when: appDelegate.minimized
@@ -1403,14 +1386,6 @@ FocusScope {
14031386 to: "staged,stagedWithSideStage"
14041387 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
14051388 },
1406− Transition {
1407− from: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,minimized";
1408− to: "normal,restored"
1409− enabled: appDelegate.animationsEnabled
1410− PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1411− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,windowedX,windowedY,requestedWidth,requestedHeight,windowedWidth,windowedHeight,scale";
1412− duration: priv.animationDuration }
1413− },
14141389 Transition {
14151390 to: "minimized"
14161391 enabled: appDelegate.animationsEnabled
@@ -1470,8 +1445,8 @@ FocusScope {
14701445 },
14711446 Transition {
14721447 id: windowedTransition
1473− from: "normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1474− to: "normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1448+ from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
1449+ to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
14751450 enabled: appDelegate.animationsEnabled
14761451 SequentialAnimation {
14771452 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
tests/mocks/Unity/Application/MirSurface.h+4
@@ -141,6 +141,9 @@ public:
141141
142142 void setState(Mir::State state);
143143
144+ Mir::State previousState() const { return m_previousState; }
145+ void setPreviousState(Mir::State state) { m_previousState = state; }
146+
144147public Q_SLOTS:
145148 ////
146149 // unity.shell.application.MirSurface
@@ -174,6 +177,7 @@ private:
174177 const QString m_name;
175178 const Mir::Type m_type;
176179 Mir::State m_state;
180+ Mir::State m_previousState{Mir::UnknownState};
177181 Mir::OrientationAngle m_orientationAngle;
178182
179183 QUrl m_screenshotUrl;
tests/mocks/Unity/Application/SurfaceManager.cpp+7−4
@@ -164,9 +164,7 @@ void SurfaceManager::doRaise(unityapi::MirSurfaceInterface *apiSurface)
164164 Q_ASSERT(index != -1);
165165 m_surfaces.move(index, 0);
166166
167− QVector<MirSurfaceInterface*> surfaces;
168− surfaces.append(surface);
169− Q_EMIT surfacesRaised(surfaces);
167+ Q_EMIT surfacesRaised({surface});
170168}
171169
172170void SurfaceManager::activate(unityapi::MirSurfaceInterface *apiSurface)
@@ -187,7 +185,11 @@ void SurfaceManager::activate(unityapi::MirSurfaceInterface *apiSurface)
187185 }
188186 if (surface) {
189187 if (surface->state() == Mir::HiddenState || surface->state() == Mir::MinimizedState) {
190− surface->setState(Mir::RestoredState);
188+ if (surface->previousState() != Mir::UnknownState) {
189+ surface->setState(surface->previousState());
190+ } else {
191+ surface->setState(Mir::RestoredState);
192+ }
191193 }
192194 surface->setFocused(true);
193195 doRaise(surface);
@@ -206,6 +208,7 @@ void SurfaceManager::onStateRequested(MirSurface *surface, Mir::State state)
206208 Q_EMIT modificationsStarted();
207209 m_underModification = true;
208210
211+ surface->setPreviousState(surface->state());
209212 surface->setState(state);
210213
211214 if ((state == Mir::MinimizedState || state == Mir::HiddenState) && surface->focused()) {
tests/qmltests/Stage/tst_DesktopStage.qml+1−1
@@ -560,7 +560,7 @@ Item {
560560
561561 // restore without raising
562562 dialerDelegate.requestRestore();
563− compare(dashDelegate.surface.exposed, true);
563+ tryCompare(dashDelegate.surface, "exposed", true);
564564 compare(gmailDelegate.surface.exposed, true);
565565 }
566566