on xenial help sign in
Restore the double tap decoration to maximize feature (LP: #1627281)

Approved by: Michael Zanetti

commitf8f8415d83d24cf56eb2e21b55c20f072f98d838 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateMon 24 Oct 2016, 11:34 (10 years ago) parentba02263ca1b837
3 files changed+22−3
qml/Stage/MoveHandler.qml+2−1 qml/Stage/Stage.qml+4−2 tests/qmltests/Stage/tst_DesktopStage.qml+16
qml/Stage/MoveHandler.qml+2−1
@@ -103,7 +103,8 @@ QtObject {
103103 if (priv.dragging) {
104104 Mir.cursorName = "grabbing";
105105
106− if (target.anyMaximized) { // restore from maximized when dragging away from edges/corners
106+ // restore from maximized when dragging away from edges/corners; guard against inadvertent changes when going into maximized state
107+ if (target.anyMaximized && !target.windowedTransitionRunning) {
107108 priv.progress = 0;
108109 target.restore(false, WindowStateStorage.WindowStateNormal);
109110 }
qml/Stage/Stage.qml+4−2
@@ -722,6 +722,7 @@ FocusScope {
722722 readonly property string appName: model.application ? model.application.name : ""
723723 property bool visuallyMaximized: false
724724 property bool visuallyMinimized: false
725+ readonly property alias windowedTransitionRunning: windowedTransition.running
725726
726727 property int stage: ApplicationInfoInterface.MainStage
727728 function saveStage(newStage) {
@@ -1173,7 +1174,7 @@ FocusScope {
11731174 }
11741175 },
11751176 State {
1176− name: "maximized"; when: appDelegate.windowState == WindowStateStorage.WindowStateMaximized
1177+ name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
11771178 PropertyChanges {
11781179 target: appDelegate;
11791180 requestedX: root.leftMargin;
@@ -1313,7 +1314,7 @@ FocusScope {
13131314 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,opacity,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
13141315 },
13151316 Transition {
1316− from: "normal,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight";
1317+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight";
13171318 to: "staged,stagedWithSideStage"
13181319 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
13191320 },
@@ -1390,6 +1391,7 @@ FocusScope {
13901391 }
13911392 },
13921393 Transition {
1394+ id: windowedTransition
13931395 from: "normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
13941396 to: "normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
13951397 enabled: appDelegate.animationsEnabled
tests/qmltests/Stage/tst_DesktopStage.qml+16
@@ -772,5 +772,21 @@ Item {
772772
773773 tryCompare(mouseEaterSpy, "count", 0);
774774 }
775+
776+ // regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1627281
777+ function test_doubleTapToMaximizeWindow() {
778+ var dialerAppDelegate = startApplication("dialer-app");
779+ verify(dialerAppDelegate);
780+ var decoration = findChild(dialerAppDelegate, "appWindowDecoration");
781+ verify(decoration);
782+
783+ // simulate a double tap, with a slight erroneous move in between those 2 taps
784+ tap(decoration);
785+ touchPress(decoration);
786+ touchMove(decoration, decoration.width/2, decoration.height/2 - 10)
787+ touchRelease(decoration);
788+
789+ tryCompare(dialerAppDelegate, "state", "maximized");
790+ }
775791 }
776792}