@@ -117,8 +117,7 @@ FocusScope {
120− property Item itemConfiningMouseCursor: !spreadShown && priv.focusedAppDelegate && priv.focusedAppDelegate.surface &&
120+ property Item itemConfiningMouseCursor: !spreadShown && priv.focusedAppDelegate && priv.focusedAppDelegate.window.confinesMousePointer ?
121− priv.focusedAppDelegate.surface.confinesMousePointer ?
122 priv.focusedAppDelegate.clientAreaItem : null;
121 priv.focusedAppDelegate.clientAreaItem : null;
124 signal itemSnapshotRequested(Item item)
123 signal itemSnapshotRequested(Item item)
@@ -184,29 +183,34 @@ FocusScope {
184 GlobalShortcut {
183 GlobalShortcut {
185 id: maximizeWindowShortcut
184 id: maximizeWindowShortcut
186 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Up
185 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Up
187− onTriggered: priv.focusedAppDelegate.maximize()
186+ onTriggered: priv.focusedAppDelegate.requestMaximize()
188 active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximized
187 active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximized
191 GlobalShortcut {
190 GlobalShortcut {
192 id: maximizeWindowLeftShortcut
191 id: maximizeWindowLeftShortcut
193 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Left
192 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Left
194− onTriggered: priv.focusedAppDelegate.maximizeLeft()
193+ onTriggered: priv.focusedAppDelegate.requestMaximizeLeft()
195 active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight
194 active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight
198 GlobalShortcut {
197 GlobalShortcut {
199 id: maximizeWindowRightShortcut
198 id: maximizeWindowRightShortcut
200 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Right
199 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Right
201− onTriggered: priv.focusedAppDelegate.maximizeRight()
200+ onTriggered: priv.focusedAppDelegate.requestMaximizeRight()
202 active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight
201 active: root.state == "windowed" && priv.focusedAppDelegate && priv.focusedAppDelegate.canBeMaximizedLeftRight
205 GlobalShortcut {
204 GlobalShortcut {
206 id: minimizeRestoreShortcut
205 id: minimizeRestoreShortcut
207 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Down
206 shortcut: Qt.MetaModifier|Qt.ControlModifier|Qt.Key_Down
208− onTriggered: priv.focusedAppDelegate.anyMaximized
208+ if (priv.focusedAppDelegate.anyMaximized) {
209− ? priv.focusedAppDelegate.restoreFromMaximized() : priv.focusedAppDelegate.minimize()
209+ priv.focusedAppDelegate.requestRestore();
211+ priv.focusedAppDelegate.requestMinimize();
210 active: root.state == "windowed" && priv.focusedAppDelegate
214 active: root.state == "windowed" && priv.focusedAppDelegate
@@ -242,20 +246,10 @@ FocusScope {
244 function minimizeAllWindows() {
248 function minimizeAllWindows() {
245− for (var i = 0; i < appRepeater.count; i++) {
249+ for (var i = appRepeater.count - 1; i >= 0; i--) {
246− var appDelegate = appRepeater.itemAt(i);
247− if (appDelegate && !appDelegate.minimized) {
248− appDelegate.minimize();
253− function focusNext() {
254− for (var i = 0; i < appRepeater.count; i++) {
255 var appDelegate = appRepeater.itemAt(i);
250 var appDelegate = appRepeater.itemAt(i);
256 if (appDelegate && !appDelegate.minimized) {
251 if (appDelegate && !appDelegate.minimized) {
257− appDelegate.focus = true;
252+ appDelegate.requestMinimize();
@@ -356,8 +350,8 @@ FocusScope {
356 Connections {
350 Connections {
357 target: PanelState
351 target: PanelState
358 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
352 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
359− onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.minimize(); } }
353+ onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
360− onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.restoreFromMaximized(); } }
354+ onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
363 Binding {
357 Binding {
@@ -432,13 +426,6 @@ FocusScope {
436− target: MirFocusController
437− property: "focusedSurface"
438− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
439− when: !appRepeater.startingUp && root.parent
442 states: [
429 states: [
444 name: "spread"; when: priv.goneToSpread
431 name: "spread"; when: priv.goneToSpread
@@ -631,7 +618,7 @@ FocusScope {
632 onShownChanged: {
619 onShownChanged: {
633 if (!shown && priv.mainStageDelegate && !root.spreadShown) {
620 if (!shown && priv.mainStageDelegate && !root.spreadShown) {
634− priv.mainStageDelegate.claimFocus();
621+ priv.mainStageDelegate.activate();
@@ -664,14 +651,23 @@ FocusScope {
667− TopLevelSurfaceRepeater {
654+ Repeater {
668 id: appRepeater
655 id: appRepeater
669 model: topLevelSurfaceList
656 model: topLevelSurfaceList
670 objectName: "appRepeater"
657 objectName: "appRepeater"
659+ function indexOf(delegateItem) {
660+ for (var i = 0; i < count; i++) {
661+ if (itemAt(i) === delegateItem) {
672 delegate: FocusScope {
668 delegate: FocusScope {
673 id: appDelegate
669 id: appDelegate
674− objectName: "appDelegate_" + model.id
670+ objectName: "appDelegate_" + model.window.id
675 property int itemIndex: index // We need this from outside the repeater
671 property int itemIndex: index // We need this from outside the repeater
676 // z might be overriden in some cases by effects, but we need z ordering
672 // z might be overriden in some cases by effects, but we need z ordering
677 // to calculate occlusion detection
673 // to calculate occlusion detection
@@ -683,11 +679,11 @@ FocusScope {
684 z: normalZ
680 z: normalZ
686− // Normally we want x/y where we request it to be. Width/height of our delegate will
682+ // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
687 // match what the actual surface size is.
683 // match what the actual surface size is.
688 // Don't write to those, they will be set by states
684 // Don't write to those, they will be set by states
689− x: requestedX
685+ x: model.window.position.x - clientAreaItem.x
690− y: requestedY
686+ y: model.window.position.y - clientAreaItem.y
691 width: decoratedWindow.implicitWidth
687 width: decoratedWindow.implicitWidth
692 height: decoratedWindow.implicitHeight
688 height: decoratedWindow.implicitHeight
@@ -697,6 +693,12 @@ FocusScope {
697 property real requestedY: windowedY
693 property real requestedY: windowedY
698 property real requestedWidth: windowedWidth
694 property real requestedWidth: windowedWidth
699 property real requestedHeight: windowedHeight
695 property real requestedHeight: windowedHeight
697+ target: model.window; property: "requestedPosition"
698+ // miral doesn't know about our window decorations. So we have to deduct them
699+ value: Qt.point(appDelegate.requestedX + appDelegate.clientAreaItem.x,
700+ appDelegate.requestedY + appDelegate.clientAreaItem.y)
701 // In those are for windowed mode. Those values basically store the window's properties
703 // In those are for windowed mode. Those values basically store the window's properties
702 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
704 // when having a floating window. If you want to move/resize a window in normal mode, this is what you want to write to.
@@ -788,7 +790,7 @@ FocusScope {
788 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
790 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
790 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
792 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
791− readonly property bool fullscreen: surface ? surface.state === Mir.FullscreenState : application.fullscreen
793+ readonly property bool fullscreen: window.state === Mir.FullscreenState
793 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
795 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
794 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
796 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
@@ -814,7 +816,9 @@ FocusScope {
814 priv.updateMainAndSideStageIndexes()
816 priv.updateMainAndSideStageIndexes()
817− readonly property var surface: model.surface
819+ readonly property var surface: model.window.surface
820+ readonly property var window: model.window
818 readonly property alias resizeArea: resizeArea
822 readonly property alias resizeArea: resizeArea
819 readonly property alias focusedSurface: decoratedWindow.focusedSurface
823 readonly property alias focusedSurface: decoratedWindow.focusedSurface
820 readonly property bool dragging: touchControls.overlayShown ? touchControls.dragging : decoratedWindow.dragging
824 readonly property bool dragging: touchControls.overlayShown ? touchControls.dragging : decoratedWindow.dragging
@@ -823,6 +827,25 @@ FocusScope {
823 readonly property bool isDash: appId == "unity8-dash"
827 readonly property bool isDash: appId == "unity8-dash"
824 readonly property alias clientAreaItem: decoratedWindow.clientAreaItem
828 readonly property alias clientAreaItem: decoratedWindow.clientAreaItem
830+ function activate() {
831+ if (model.window.focused) {
832+ updateQmlFocusFromMirSurfaceFocus();
834+ model.window.activate();
837+ function requestMaximize() { model.window.requestState(Mir.MaximizedState); }
838+ function requestMaximizeVertically() { model.window.requestState(Mir.VertMaximizedState); }
839+ function requestMaximizeHorizontally() { model.window.requestState(Mir.HorizMaximizedState); }
840+ function requestMaximizeLeft() { model.window.requestState(Mir.MaximizedLeftState); }
841+ function requestMaximizeRight() { model.window.requestState(Mir.MaximizedRightState); }
842+ function requestMaximizeTopLeft() { model.window.requestState(Mir.MaximizedTopLeftState); }
843+ function requestMaximizeTopRight() { model.window.requestState(Mir.MaximizedTopRightState); }
844+ function requestMaximizeBottomLeft() { model.window.requestState(Mir.MaximizedBottomLeftState); }
845+ function requestMaximizeBottomRight() { model.window.requestState(Mir.MaximizedBottomRightState); }
846+ function requestMinimize() { model.window.requestState(Mir.MinimizedState); }
847+ function requestRestore() { model.window.requestState(Mir.RestoredState); }
826 function claimFocus() {
849 function claimFocus() {
827 if (root.state == "spread") {
850 if (root.state == "spread") {
828 spreadItem.highlightedIndex = index
851 spreadItem.highlightedIndex = index
@@ -834,43 +857,16 @@ FocusScope {
835 priv.updateMainAndSideStageIndexes();
858 priv.updateMainAndSideStageIndexes();
838 if (root.mode == "windowed") {
860 if (root.mode == "windowed") {
839 appDelegate.restore(true /* animated */, appDelegate.windowState);
861 appDelegate.restore(true /* animated */, appDelegate.windowState);
841− appDelegate.focus = true;
845− target: model.surface
851− target: model.application
853− if (!model.surface) {
854− // when an app has no surfaces, we assume there's only one entry representing it:
858− // if the application has surfaces, focus request should be at surface-level.
863+ appDelegate.focus = true;
863− onFocusChanged: {
866+ function updateQmlFocusFromMirSurfaceFocus() {
864− if (appRepeater.startingUp)
867+ if (model.window.focused) {
865− return;
868+ claimFocus();
868− topLevelSurfaceList.raiseId(model.id);
869 priv.focusedAppDelegate = appDelegate;
869 priv.focusedAppDelegate = appDelegate;
870− } else if (!focus && priv.focusedAppDelegate === appDelegate && root.state != "spread") {
871− priv.focusedAppDelegate = null;
872− // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null
873− MirFocusController.focusedSurface = null;
@@ -883,6 +879,41 @@ FocusScope {
883 minimumY: PanelState.panelHeight
879 minimumY: PanelState.panelHeight
883+ target: model.window
885+ updateQmlFocusFromMirSurfaceFocus();
888+ appDelegate.activate();
891+ if (model.window.state === Mir.MinimizedState) {
892+ appDelegate.minimize();
893+ } else if (model.window.state === Mir.MaximizedState) {
894+ appDelegate.maximize();
895+ } else if (model.window.state === Mir.VertMaximizedState) {
896+ appDelegate.maximizeVertically();
897+ } else if (model.window.state === Mir.HorizMaximizedState) {
898+ appDelegate.maximizeHorizontally();
899+ } else if (model.window.state === Mir.MaximizedLeftState) {
900+ appDelegate.maximizeLeft();
901+ } else if (model.window.state === Mir.MaximizedRightState) {
902+ appDelegate.maximizeRight();
903+ } else if (model.window.state === Mir.MaximizedTopLeftState) {
904+ appDelegate.maximizeTopLeft();
905+ } else if (model.window.state === Mir.MaximizedTopRightState) {
906+ appDelegate.maximizeTopRight();
907+ } else if (model.window.state === Mir.MaximizedBottomLeftState) {
908+ appDelegate.maximizeBottomLeft();
909+ } else if (model.window.state === Mir.MaximizedBottomRightState) {
910+ appDelegate.maximizeBottomRight();
911+ } else if (model.window.state === Mir.RestoredState) {
912+ appDelegate.restore();
886 Component.onCompleted: {
917 Component.onCompleted: {
887 if (application && application.rotatesWindowContents) {
918 if (application && application.rotatesWindowContents) {
888 decoratedWindow.surfaceOrientationAngle = shellOrientationAngle;
919 decoratedWindow.surfaceOrientationAngle = shellOrientationAngle;
@@ -895,17 +926,9 @@ FocusScope {
895 windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
926 windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
896 // Now load any saved state. This needs to happen *after* the cascading!
927 // Now load any saved state. This needs to happen *after* the cascading!
897 windowStateSaver.load();
928 windowStateSaver.load();
929+ model.window.requestState(WindowStateStorage.toMirState(windowState));
899− // NB: We're differentiating if this delegate was created in response to a new entry in the model
931+ updateQmlFocusFromMirSurfaceFocus();
900− // or if the Repeater is just populating itself with delegates to match the model it received.
901− if (!appRepeater.startingUp) {
902− // a top level window is always the focused one when it first appears, unfocusing
903− // any preexisting one
904− if (root.state == "spread") {
905− spreadItem.highlightedIndex = index;
910 refreshStage();
933 refreshStage();
911 _constructing = false;
934 _constructing = false;
@@ -921,17 +944,6 @@ FocusScope {
921 if (visuallyMaximized) {
944 if (visuallyMaximized) {
922 priv.updateForegroundMaximizedApp();
945 priv.updateForegroundMaximizedApp();
926− // focus some other window
927− for (var i = 0; i < appRepeater.count; i++) {
928− var appDelegate = appRepeater.itemAt(i);
929− if (appDelegate && !appDelegate.minimized && i != index) {
930− appDelegate.focus = true;
937 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
949 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
@@ -952,7 +964,7 @@ FocusScope {
952 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
964 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
954 function close() {
966 function close() {
955− model.surface.close();
967+ model.window.close();
958 function maximize(animated) {
970 function maximize(animated) {
@@ -995,15 +1007,10 @@ FocusScope {
995 animationsEnabled = (animated === undefined) || animated;
1007 animationsEnabled = (animated === undefined) || animated;
996 windowState |= WindowStateStorage.WindowStateMinimized; // add the minimized bit
1008 windowState |= WindowStateStorage.WindowStateMinimized; // add the minimized bit
998− function restoreFromMaximized(animated) {
999− animationsEnabled = (animated === undefined) || animated;
1000− windowState = WindowStateStorage.WindowStateRestored;
1002 function restore(animated,state) {
1010 function restore(animated,state) {
1003 animationsEnabled = (animated === undefined) || animated;
1011 animationsEnabled = (animated === undefined) || animated;
1004 windowState = state || WindowStateStorage.WindowStateRestored;
1012 windowState = state || WindowStateStorage.WindowStateRestored;
1005 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1013 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1009 function playFocusAnimation() {
1016 function playFocusAnimation() {
@@ -1017,7 +1024,7 @@ FocusScope {
1017 rightEdgeFocusAnimation.start()
1024 rightEdgeFocusAnimation.start()
1019 } else if (state == "windowedRightEdge" || state == "windowed") {
1026 } else if (state == "windowedRightEdge" || state == "windowed") {
1020− claimFocus();
1027+ activate();
1021 } else {
1028 } else {
1022 focusAnimation.start()
1029 focusAnimation.start()
@@ -1055,10 +1062,10 @@ FocusScope {
1056 duration: UbuntuAnimation.SnapDuration
1063 duration: UbuntuAnimation.SnapDuration
1057 onStarted: {
1064 onStarted: {
1058− topLevelSurfaceList.raiseId(model.id);
1065+ topLevelSurfaceList.raiseId(model.window.id);
1060 onStopped: {
1067 onStopped: {
1061− appDelegate.claimFocus();
1068+ appDelegate.activate();
1064 ParallelAnimation {
1071 ParallelAnimation {
@@ -1068,7 +1075,7 @@ FocusScope {
1068 UbuntuNumberAnimation { target: decoratedWindow; properties: "angle"; to: 0; duration: priv.animationDuration }
1075 UbuntuNumberAnimation { target: decoratedWindow; properties: "angle"; to: 0; duration: priv.animationDuration }
1069 UbuntuNumberAnimation { target: decoratedWindow; properties: "itemScale"; to: 1; duration: priv.animationDuration }
1076 UbuntuNumberAnimation { target: decoratedWindow; properties: "itemScale"; to: 1; duration: priv.animationDuration }
1070 onStopped: {
1077 onStopped: {
1071− appDelegate.focus = true
1078+ appDelegate.activate();
1074 ParallelAnimation {
1081 ParallelAnimation {
@@ -1318,15 +1325,9 @@ FocusScope {
1318 windowedY: restoredY;
1325 windowedY: restoredY;
1322− name: "semiMaximized"
1323− PropertyChanges { target: touchControls; enabled: true }
1324− PropertyChanges { target: resizeArea; enabled: true }
1325− PropertyChanges { target: decoratedWindow; shadowOpacity: .3 }
1328 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
1329 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
1329− extend: "semiMaximized"
1330+ extend: "normal"
1330 PropertyChanges {
1331 PropertyChanges {
1331 target: appDelegate
1332 target: appDelegate
1332 windowedX: root.leftMargin
1333 windowedX: root.leftMargin
@@ -1345,7 +1346,7 @@ FocusScope {
1347 name: "maximizedTopLeft"; when: appDelegate.maximizedTopLeft && !appDelegate.minimized
1348 name: "maximizedTopLeft"; when: appDelegate.maximizedTopLeft && !appDelegate.minimized
1348− extend: "semiMaximized"
1349+ extend: "normal"
1349 PropertyChanges {
1350 PropertyChanges {
1350 target: appDelegate
1351 target: appDelegate
1351 windowedX: root.leftMargin
1352 windowedX: root.leftMargin
@@ -1364,7 +1365,7 @@ FocusScope {
1366 name: "maximizedBottomLeft"; when: appDelegate.maximizedBottomLeft && !appDelegate.minimized
1367 name: "maximizedBottomLeft"; when: appDelegate.maximizedBottomLeft && !appDelegate.minimized
1367− extend: "semiMaximized"
1368+ extend: "normal"
1368 PropertyChanges {
1369 PropertyChanges {
1369 target: appDelegate
1370 target: appDelegate
1370 windowedX: root.leftMargin
1371 windowedX: root.leftMargin
@@ -1383,15 +1384,15 @@ FocusScope {
1385 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1386 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
1386− extend: "semiMaximized"
1387+ extend: "normal"
1387− PropertyChanges { target: appDelegate; requestedX: root.leftMargin; requestedY: windowedY;
1388+ PropertyChanges { target: appDelegate; windowedX: root.leftMargin; windowedY: windowedY;
1388− requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appDelegate.windowedHeight }
1389+ windowedWidth: appContainer.width - root.leftMargin; windowedHeight: windowedHeight }
1391 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1392 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
1392− extend: "semiMaximized"
1393+ extend: "normal"
1393− PropertyChanges { target: appDelegate; requestedX: windowedX; requestedY: PanelState.panelHeight;
1394+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1394− requestedWidth: appDelegate.windowedWidth; requestedHeight: appContainer.height - PanelState.panelHeight }
1395+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1397 name: "minimized"; when: appDelegate.minimized
1398 name: "minimized"; when: appDelegate.minimized
@@ -1417,14 +1418,6 @@ FocusScope {
1417 to: "staged,stagedWithSideStage"
1418 to: "staged,stagedWithSideStage"
1418 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1419 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1421− from: "maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,minimized";
1422− to: "normal,restored"
1423− enabled: appDelegate.animationsEnabled
1424− PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
1425− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,windowedX,windowedY,requestedWidth,requestedHeight,windowedWidth,windowedHeight,scale";
1426− duration: priv.animationDuration }
1428 Transition {
1421 Transition {
1429 to: "minimized"
1422 to: "minimized"
1430 enabled: appDelegate.animationsEnabled
1423 enabled: appDelegate.animationsEnabled
@@ -1432,14 +1425,6 @@ FocusScope {
1432 SequentialAnimation {
1425 SequentialAnimation {
1433 UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
1426 UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
1434 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1427 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1437− if (appDelegate.minimized) {
1438− appDelegate.focus = false;
1445 Transition {
1430 Transition {
@@ -1492,8 +1477,8 @@ FocusScope {
1493 Transition {
1478 Transition {
1494 id: windowedTransition
1479 id: windowedTransition
1495− from: "normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1480+ from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
1496− to: "normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTop,maximizedBottom,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1481+ to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1497 enabled: appDelegate.animationsEnabled
1482 enabled: appDelegate.animationsEnabled
1498 SequentialAnimation {
1483 SequentialAnimation {
1499 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1484 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
@@ -1529,7 +1514,7 @@ FocusScope {
1529 visible: enabled
1514 visible: enabled
1531 onPressed: {
1516 onPressed: {
1532− appDelegate.focus = true;
1517+ appDelegate.activate();
@@ -1539,7 +1524,7 @@ FocusScope {
1539 anchors.left: appDelegate.left
1524 anchors.left: appDelegate.left
1540 anchors.top: appDelegate.top
1525 anchors.top: appDelegate.top
1541 application: model.application
1526 application: model.application
1542− surface: model.surface
1527+ surface: model.window.surface
1543 active: appDelegate.focus
1528 active: appDelegate.focus
1544 focus: true
1529 focus: true
1545 interactive: root.interactive
1530 interactive: root.interactive
@@ -1564,21 +1549,21 @@ FocusScope {
1564 onCloseClicked: { appDelegate.close(); }
1549 onCloseClicked: { appDelegate.close(); }
1565 onMaximizeClicked: {
1550 onMaximizeClicked: {
1566 if (appDelegate.canBeMaximized) {
1551 if (appDelegate.canBeMaximized) {
1567− appDelegate.anyMaximized ? appDelegate.restoreFromMaximized() : appDelegate.maximize();
1552+ appDelegate.anyMaximized ? appDelegate.requestRestore() : appDelegate.requestMaximize();
1570 onMaximizeHorizontallyClicked: {
1555 onMaximizeHorizontallyClicked: {
1571 if (appDelegate.canBeMaximizedHorizontally) {
1556 if (appDelegate.canBeMaximizedHorizontally) {
1572− appDelegate.maximizedHorizontally ? appDelegate.restoreFromMaximized() : appDelegate.maximizeHorizontally()
1557+ appDelegate.maximizedHorizontally ? appDelegate.requestRestore() : appDelegate.requestMaximizeHorizontally()
1575 onMaximizeVerticallyClicked: {
1560 onMaximizeVerticallyClicked: {
1576 if (appDelegate.canBeMaximizedVertically) {
1561 if (appDelegate.canBeMaximizedVertically) {
1577− appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
1562+ appDelegate.maximizedVertically ? appDelegate.requestRestore() : appDelegate.requestMaximizeVertically()
1580− onMinimizeClicked: appDelegate.minimize()
1565+ onMinimizeClicked: { appDelegate.requestMinimize(); }
1581− onDecorationPressed: { appDelegate.focus = true; }
1566+ onDecorationPressed: { appDelegate.activate(); }
1582 onDecorationReleased: fakeRectangle.commit();
1567 onDecorationReleased: fakeRectangle.commit();
1584 property real angle: 0
1569 property real angle: 0
@@ -1625,12 +1610,12 @@ FocusScope {
1625 WindowedFullscreenPolicy {
1610 WindowedFullscreenPolicy {
1626 id: windowedFullscreenPolicy
1611 id: windowedFullscreenPolicy
1627 active: root.mode == "windowed"
1612 active: root.mode == "windowed"
1628− surface: model.surface
1613+ surface: model.window.surface
1630 StagedFullscreenPolicy {
1615 StagedFullscreenPolicy {
1631 id: stagedFullscreenPolicy
1616 id: stagedFullscreenPolicy
1632 active: root.mode == "staged" || root.mode == "stagedWithSideStage"
1617 active: root.mode == "staged" || root.mode == "stagedWithSideStage"
1633− surface: model.surface
1618+ surface: model.window.surface
1636 SpreadDelegateInputArea {
1621 SpreadDelegateInputArea {
@@ -1643,16 +1628,13 @@ FocusScope {
1643 onClicked: {
1628 onClicked: {
1644 spreadItem.highlightedIndex = index;
1629 spreadItem.highlightedIndex = index;
1645 if (distance == 0) {
1630 if (distance == 0) {
1631+ model.window.activate();
1646 priv.goneToSpread = false;
1632 priv.goneToSpread = false;
1649 onClose: {
1635 onClose: {
1650 priv.closingIndex = index
1636 priv.closingIndex = index
1651− if (model.surface) { // could be stopped by OOM
1637+ model.window.close();
1652− model.surface.close()
1653− } else if (model.application) {
1654− root.applicationManager.stopApplication(model.application.appId);