on xenial help sign in
some fixes in windowed mode state transitions
commit3e4449f5045a4f6f9efb83fd03df172cc854e5fb authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 13 Sep 2016, 11:26 (10 years ago) parent15f6813
1 file changed+28−45
qml/Stage/Stage.qml+28−45
qml/Stage/Stage.qml+28−45
@@ -587,10 +587,10 @@ AbstractStage {
587587
588588 // requestedX/Y/width/height is what we ask the actual surface to be.
589589 // Do not write to those, they will be set by states
590− property real requestedX: 0
591− property real requestedY: 0
592− property int requestedWidth: -1
593− property int requestedHeight: -1
590+ property real requestedX: windowedX
591+ property real requestedY: windowedY
592+ property int requestedWidth: windowedWidth
593+ property int requestedHeight: windowedHeight
594594
595595 // In those are for windowed mode. Those values basically store the window's properties
596596 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
@@ -619,7 +619,7 @@ AbstractStage {
619619 onShellOrientationAngleChanged: {
620620 // at this point decoratedWindow.surfaceOrientationAngle is the old shellOrientationAngle
621621 if (application && application.rotatesWindowContents) {
622− if (state == "normal" || state == "restored") {
622+ if (root.state == "windowed") {
623623 var angleDiff = decoratedWindow.surfaceOrientationAngle - shellOrientationAngle;
624624 angleDiff = (360 + angleDiff) % 360;
625625 if (angleDiff === 90 || angleDiff === 270) {
@@ -698,14 +698,15 @@ AbstractStage {
698698 if (root.state == "spread") {
699699 priv.goneToSpread = false;
700700 }
701− if (root.mode == "windowed" && minimized) {
702− restore(true)
703− }
704701 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
705702 sideStage.show();
706703 }
707− appDelegate.focus = true;
708− appDelegate.restore(true /* animated */, appDelegate.windowState);
704+
705+ if (root.mode == "windowed") {
706+ appDelegate.restore(true /* animated */, appDelegate.windowState);
707+ } else {
708+ appDelegate.focus = true;
709+ }
709710 }
710711 Connections {
711712 target: model.surface
@@ -737,7 +738,6 @@ AbstractStage {
737738 if (focus) {
738739 topLevelSurfaceList.raiseId(model.id);
739740 priv.focusedAppDelegate = appDelegate;
740− topLevelSurfaceList.raiseId(model.id);
741741 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
742742 priv.focusedAppDelegate = null;
743743 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null
@@ -871,7 +871,7 @@ AbstractStage {
871871 rightEdgeFocusAnimation.targetX = appDelegate.stage == ApplicationInfoInterface.SideStage ? sideStage.x : 0
872872 rightEdgeFocusAnimation.start()
873873 }
874− } else if (state == "windowedRightEdge") {
874+ } else if (state == "windowedRightEdge" || root.mode == "windowed") {
875875 print("claiming focus 1")
876876 claimFocus();
877877 } else {
@@ -1160,8 +1160,6 @@ AbstractStage {
11601160 target: appDelegate
11611161 visuallyMinimized: false
11621162 visuallyMaximized: false
1163− requestedX: appDelegate.windowedX
1164− requestedY: appDelegate.windowedY
11651163 requestedWidth: appDelegate.windowedWidth
11661164 requestedHeight: appDelegate.windowedHeight
11671165 }
@@ -1182,6 +1180,7 @@ AbstractStage {
11821180 State {
11831181 name: "semiMaximized"
11841182 PropertyChanges { target: touchControls; enabled: true }
1183+ PropertyChanges { target: resizeArea; enabled: true }
11851184 PropertyChanges { target: decoratedWindow; shadowOpacity: .3 }
11861185 },
11871186 State {
@@ -1244,36 +1243,21 @@ AbstractStage {
12441243 State {
12451244 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
12461245 extend: "semiMaximized"
1247− PropertyChanges {
1248− target: appDelegate;
1249− requestedX: root.leftMargin
1250− requestedY: appDelegate.windowedY
1251− requestedWidth: appContainer.width - root.leftMargin
1252− requestedHeight: appDelegate.windowedHeight
1253− }
1254− PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: requestedY; requestedWidth: appContainer.width - root.leftMargin }
1246+ PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: requestedY;
1247+ requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appDelegate.windowedHeight }
12551248 },
12561249 State {
12571250 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1258− PropertyChanges {
1259− target: appDelegate;
1260− requestedX: appDelegate.windowedX
1261− requestedY: PanelState.panelHeight
1262− requestedWidth: appDelegate.windowedWidth
1263− requestedHeight: appContainer.height - PanelState.panelHeight
1264− }
1265− PropertyChanges { target: appDelegate; requestedX: requestedX; requestedY: PanelState.panelHeight; requestedHeight: appContainer.height - PanelState.panelHeight }
1251+ extend: "semiMaximized"
1252+ PropertyChanges { target: appDelegate; requestedX: requestedX; requestedY: PanelState.panelHeight;
1253+ requestedWidth: appDelegate.windowedWidth; requestedHeight: appContainer.height - PanelState.panelHeight }
12661254 },
12671255 State {
12681256 name: "minimized"; when: appDelegate.minimized
12691257 PropertyChanges {
12701258 target: appDelegate
1271− requestedWidth: decoratedWindow.oldRequestedWidth
1272− requestedHeight: decoratedWindow.oldRequestedHeight
1273− x: -appDelegate.width / 2;
1274− y: requestedY // TODO: Should be where the icon is in the launcher. Lets just move it horizontally to the left for now.
1275− scale: units.gu(5) / appDelegate.width
12761259 requestedX: -appDelegate.width / 2
1260+ scale: units.gu(5) / appDelegate.width
12771261 opacity: 0;
12781262 visuallyMinimized: true
12791263 visuallyMaximized: false
@@ -1288,24 +1272,23 @@ AbstractStage {
12881272 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,opacity,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
12891273 },
12901274 Transition {
1291− from: "normal,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight"; to: "staged,stagedWithSideStage"
1275+ from: "normal,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight";
1276+ to: "staged,stagedWithSideStage"
12921277 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
12931278 },
12941279 Transition {
1295− from: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,minimized"; to: "normal"
1280+ from: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,minimized";
1281+ to: "normal,restored"
12961282 enabled: appDelegate.animationsEnabled
12971283 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1298− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
1284+ UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,restoredX,restoredY,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
12991285 },
13001286 Transition {
13011287 to: "minimized"
13021288 enabled: appDelegate.animationsEnabled
13031289 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
13041290 SequentialAnimation {
1305− ParallelAnimation {
1306− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: priv.animationDuration }
1307− UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
1308− }
1291+ UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
13091292 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
13101293 ScriptAction {
13111294 script: {
@@ -1368,7 +1351,7 @@ AbstractStage {
13681351 }
13691352 },
13701353 Transition {
1371− to: "maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,fullscreen"
1354+ to: "maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
13721355 enabled: appDelegate.animationsEnabled
13731356 SequentialAnimation {
13741357 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
@@ -1552,7 +1535,7 @@ AbstractStage {
15521535 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
15531536 source: "graphics/window-close.svg"
15541537 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1555− visible: model.application.appId !== "unity8-dash"
1538+ visible: !appDelegate.isDash
15561539 && index == spreadItem.highlightedIndex
15571540 && mousePos.y < (decoratedWindow.height / 3)
15581541 && mousePos.y > -units.gu(4)
@@ -1570,7 +1553,7 @@ AbstractStage {
15701553 anchors.margins: -units.gu(2)
15711554 onClicked: {
15721555 priv.closingIndex = index;
1573− model.surface.close();
1556+ appDelegate.close();
15741557 }
15751558 }
15761559 }