@@ -587,10 +587,10 @@ AbstractStage {
588 // requestedX/Y/width/height is what we ask the actual surface to be.
588 // requestedX/Y/width/height is what we ask the actual surface to be.
589 // Do not write to those, they will be set by states
589 // Do not write to those, they will be set by states
590− property real requestedX: 0
590+ property real requestedX: windowedX
591− property real requestedY: 0
591+ property real requestedY: windowedY
592− property int requestedWidth: -1
592+ property int requestedWidth: windowedWidth
593− property int requestedHeight: -1
593+ property int requestedHeight: windowedHeight
595 // In those are for windowed mode. Those values basically store the window's properties
595 // In those are for windowed mode. Those values basically store the window's properties
596 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
596 // 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 {
619 onShellOrientationAngleChanged: {
619 onShellOrientationAngleChanged: {
620 // at this point decoratedWindow.surfaceOrientationAngle is the old shellOrientationAngle
620 // at this point decoratedWindow.surfaceOrientationAngle is the old shellOrientationAngle
621 if (application && application.rotatesWindowContents) {
621 if (application && application.rotatesWindowContents) {
622− if (state == "normal" || state == "restored") {
622+ if (root.state == "windowed") {
623 var angleDiff = decoratedWindow.surfaceOrientationAngle - shellOrientationAngle;
623 var angleDiff = decoratedWindow.surfaceOrientationAngle - shellOrientationAngle;
624 angleDiff = (360 + angleDiff) % 360;
624 angleDiff = (360 + angleDiff) % 360;
625 if (angleDiff === 90 || angleDiff === 270) {
625 if (angleDiff === 90 || angleDiff === 270) {
@@ -698,14 +698,15 @@ AbstractStage {
698 if (root.state == "spread") {
698 if (root.state == "spread") {
699 priv.goneToSpread = false;
699 priv.goneToSpread = false;
701− if (root.mode == "windowed" && minimized) {
704 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
701 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
705 sideStage.show();
702 sideStage.show();
707− appDelegate.focus = true;
704+
705+ if (root.mode == "windowed") {
708− appDelegate.restore(true /* animated */, appDelegate.windowState);
706+ appDelegate.restore(true /* animated */, appDelegate.windowState);
708+ appDelegate.focus = true;
710 Connections {
711 Connections {
711 target: model.surface
712 target: model.surface
@@ -737,7 +738,6 @@ AbstractStage {
737 if (focus) {
738 if (focus) {
738 topLevelSurfaceList.raiseId(model.id);
739 topLevelSurfaceList.raiseId(model.id);
739 priv.focusedAppDelegate = appDelegate;
740 priv.focusedAppDelegate = appDelegate;
740− topLevelSurfaceList.raiseId(model.id);
741 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
741 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
742 priv.focusedAppDelegate = null;
742 priv.focusedAppDelegate = null;
743 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null
743 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null
@@ -871,7 +871,7 @@ AbstractStage {
871 rightEdgeFocusAnimation.targetX = appDelegate.stage == ApplicationInfoInterface.SideStage ? sideStage.x : 0
871 rightEdgeFocusAnimation.targetX = appDelegate.stage == ApplicationInfoInterface.SideStage ? sideStage.x : 0
872 rightEdgeFocusAnimation.start()
872 rightEdgeFocusAnimation.start()
874− } else if (state == "windowedRightEdge") {
874+ } else if (state == "windowedRightEdge" || root.mode == "windowed") {
875 print("claiming focus 1")
875 print("claiming focus 1")
876 claimFocus();
876 claimFocus();
@@ -1160,8 +1160,6 @@ AbstractStage {
1160 target: appDelegate
1160 target: appDelegate
1161 visuallyMinimized: false
1161 visuallyMinimized: false
1162 visuallyMaximized: false
1162 visuallyMaximized: false
1163− requestedX: appDelegate.windowedX
1164− requestedY: appDelegate.windowedY
1165 requestedWidth: appDelegate.windowedWidth
1163 requestedWidth: appDelegate.windowedWidth
1166 requestedHeight: appDelegate.windowedHeight
1164 requestedHeight: appDelegate.windowedHeight
@@ -1182,6 +1180,7 @@ AbstractStage {
1183 name: "semiMaximized"
1181 name: "semiMaximized"
1184 PropertyChanges { target: touchControls; enabled: true }
1182 PropertyChanges { target: touchControls; enabled: true }
1183+ PropertyChanges { target: resizeArea; enabled: true }
1185 PropertyChanges { target: decoratedWindow; shadowOpacity: .3 }
1184 PropertyChanges { target: decoratedWindow; shadowOpacity: .3 }
@@ -1244,36 +1243,21 @@ AbstractStage {
1245 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1244 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1246 extend: "semiMaximized"
1245 extend: "semiMaximized"
1248− target: appDelegate;
1249− requestedX: root.leftMargin
1246+ PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: requestedY;
1250− requestedY: appDelegate.windowedY
1251− requestedWidth: appContainer.width - root.leftMargin
1247+ requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appDelegate.windowedHeight }
1252− requestedHeight: appDelegate.windowedHeight
1254− PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: requestedY; requestedWidth: appContainer.width - root.leftMargin }
1257 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1250 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1258− PropertyChanges {
1251+ extend: "semiMaximized"
1259− target: appDelegate;
1260− requestedX: appDelegate.windowedX
1261− requestedY: PanelState.panelHeight
1252+ PropertyChanges { target: appDelegate; requestedX: requestedX; requestedY: PanelState.panelHeight;
1262− requestedWidth: appDelegate.windowedWidth
1253+ requestedWidth: appDelegate.windowedWidth; requestedHeight: appContainer.height - PanelState.panelHeight }
1263− requestedHeight: appContainer.height - PanelState.panelHeight
1265− PropertyChanges { target: appDelegate; requestedX: requestedX; requestedY: PanelState.panelHeight; requestedHeight: appContainer.height - PanelState.panelHeight }
1268 name: "minimized"; when: appDelegate.minimized
1256 name: "minimized"; when: appDelegate.minimized
1269 PropertyChanges {
1257 PropertyChanges {
1270 target: appDelegate
1258 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
1276 requestedX: -appDelegate.width / 2
1259 requestedX: -appDelegate.width / 2
1260+ scale: units.gu(5) / appDelegate.width
1277 opacity: 0;
1261 opacity: 0;
1278 visuallyMinimized: true
1262 visuallyMinimized: true
1279 visuallyMaximized: false
1263 visuallyMaximized: false
@@ -1288,24 +1272,23 @@ AbstractStage {
1288 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,opacity,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
1272 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,opacity,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
1290 Transition {
1274 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"
1292 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1277 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1294 Transition {
1279 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"
1296 enabled: appDelegate.animationsEnabled
1282 enabled: appDelegate.animationsEnabled
1297 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1283 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 }
1300 Transition {
1286 Transition {
1301 to: "minimized"
1287 to: "minimized"
1302 enabled: appDelegate.animationsEnabled
1288 enabled: appDelegate.animationsEnabled
1303 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1289 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1304 SequentialAnimation {
1290 SequentialAnimation {
1305− ParallelAnimation {
1306− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: priv.animationDuration }
1291+ UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
1307− UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
1309 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1292 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1310 ScriptAction {
1293 ScriptAction {
1311 script: {
1294 script: {
@@ -1368,7 +1351,7 @@ AbstractStage {
1370 Transition {
1353 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"
1372 enabled: appDelegate.animationsEnabled
1355 enabled: appDelegate.animationsEnabled
1373 SequentialAnimation {
1356 SequentialAnimation {
1374 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1357 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
@@ -1552,7 +1535,7 @@ AbstractStage {
1552 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1535 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
1553 source: "graphics/window-close.svg"
1536 source: "graphics/window-close.svg"
1554 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1537 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1555− visible: model.application.appId !== "unity8-dash"
1538+ visible: !appDelegate.isDash
1556 && index == spreadItem.highlightedIndex
1539 && index == spreadItem.highlightedIndex
1557 && mousePos.y < (decoratedWindow.height / 3)
1540 && mousePos.y < (decoratedWindow.height / 3)
1558 && mousePos.y > -units.gu(4)
1541 && mousePos.y > -units.gu(4)
@@ -1570,7 +1553,7 @@ AbstractStage {
1570 anchors.margins: -units.gu(2)
1553 anchors.margins: -units.gu(2)
1571 onClicked: {
1554 onClicked: {
1572 priv.closingIndex = index;
1555 priv.closingIndex = index;
1573− model.surface.close();
1556+ appDelegate.close();