@@ -46,6 +46,7 @@ FocusScope {
46 property int leftMargin: 0
46 property int leftMargin: 0
47 property bool oskEnabled: false
47 property bool oskEnabled: false
48 property rect inputMethodRect
48 property rect inputMethodRect
49+ property real rightEdgePushProgress: 0
49 property PanelState panelState
50 property PanelState panelState
51 // Configuration
52 // Configuration
@@ -102,6 +103,8 @@ FocusScope {
102 // No we didn't, do a quick alt-tab
103 // No we didn't, do a quick alt-tab
103 if (appRepeater.count > 1) {
104 if (appRepeater.count > 1) {
104 appRepeater.itemAt(1).activate();
105 appRepeater.itemAt(1).activate();
106+ } else if (appRepeater.count > 0) {
107+ appRepeater.itemAt(0).activate(); // quick alt-tab to the only (minimized) window should still activate it
@@ -126,11 +129,6 @@ FocusScope {
126 // functions to be called from outside
129 // functions to be called from outside
127 function updateFocusedAppOrientation() { /* TODO */ }
130 function updateFocusedAppOrientation() { /* TODO */ }
128 function updateFocusedAppOrientationAnimated() { /* TODO */}
131 function updateFocusedAppOrientationAnimated() { /* TODO */}
129− function pushRightEdge(amount) {
130− if (root.spreadEnabled) {
131− edgeBarrier.push(amount);
135 function closeSpread() {
133 function closeSpread() {
136 priv.goneToSpread = false;
134 priv.goneToSpread = false;
@@ -142,6 +140,12 @@ FocusScope {
143+ onRightEdgePushProgressChanged: {
144+ if (spreadEnabled && rightEdgePushProgress >= 1) {
145+ priv.goneToSpread = true
145 GSettings {
149 GSettings {
146 id: lifecycleExceptions
150 id: lifecycleExceptions
147 schema.id: "com.canonical.qtmir"
151 schema.id: "com.canonical.qtmir"
@@ -454,7 +458,7 @@ FocusScope {
454 PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
458 PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
457− name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
461+ name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
458 PropertyChanges {
462 PropertyChanges {
459 target: blurLayer;
463 target: blurLayer;
460 visible: true;
464 visible: true;
@@ -464,7 +468,7 @@ FocusScope {
467− name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
471+ name: "sideStagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "stagedWithSideStage"
468 extend: "stagedRightEdge"
472 extend: "stagedRightEdge"
469 PropertyChanges {
473 PropertyChanges {
470 target: sideStage
474 target: sideStage
@@ -473,18 +477,18 @@ FocusScope {
476− name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
480+ name: "windowedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "windowed"
477 PropertyChanges {
481 PropertyChanges {
478 target: blurLayer;
482 target: blurLayer;
479 visible: true
483 visible: true
480 blurRadius: 32
484 blurRadius: 32
481 brightness: .65
485 brightness: .65
482− opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, edgeBarrier.progress))
486+ opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, rightEdgePushProgress))
486 name: "staged"; when: root.mode === "staged"
490 name: "staged"; when: root.mode === "staged"
487− PropertyChanges { target: wallpaper; visible: priv.focusedAppDelegate && priv.focusedAppDelegate.x === 0 }
491+ PropertyChanges { target: wallpaper; visible: !priv.focusedAppDelegate || priv.focusedAppDelegate.x !== 0 }
490 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
494 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
@@ -521,6 +525,7 @@ FocusScope {
523 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
527 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
528+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
526 Transition {
531 Transition {
@@ -775,7 +780,7 @@ FocusScope {
776 id: boundariesForWindowPlacement
781 id: boundariesForWindowPlacement
777 anchors.fill: parent
782 anchors.fill: parent
778− anchors.topMargin: PanelState.panelHeight
783+ anchors.topMargin: panelState.panelHeight
779 visible: false
784 visible: false
@@ -921,7 +926,7 @@ FocusScope {
921 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
926 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
923 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
928 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
924− readonly property bool fullscreen: window.state === Mir.FullscreenState
929+ readonly property bool fullscreen: windowState === WindowStateStorage.WindowStateFullscreen
926 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
931 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
927 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
932 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
@@ -932,7 +937,10 @@ FocusScope {
932 readonly property bool canBeMaximizedVertically: maximumHeight == 0 || maximumHeight >= appContainer.height
937 readonly property bool canBeMaximizedVertically: maximumHeight == 0 || maximumHeight >= appContainer.height
933 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
938 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
940+ // TODO drop our own windowType once Mir/Miral/Qtmir gets in sync with ours
935 property int windowState: WindowStateStorage.WindowStateNormal
941 property int windowState: WindowStateStorage.WindowStateNormal
942+ property int prevWindowState: WindowStateStorage.WindowStateRestored
936 property bool animationsEnabled: true
944 property bool animationsEnabled: true
937 property alias title: decoratedWindow.title
945 property alias title: decoratedWindow.title
938 readonly property string appName: model.application ? model.application.name : ""
946 readonly property string appName: model.application ? model.application.name : ""
@@ -987,9 +995,6 @@ FocusScope {
988 priv.updateMainAndSideStageIndexes();
996 priv.updateMainAndSideStageIndexes();
990− if (root.mode == "windowed") {
991− appDelegate.restore(true /* animated */, appDelegate.windowState);
993 appDelegate.focus = true;
998 appDelegate.focus = true;
@@ -1039,7 +1044,14 @@ FocusScope {
1039 } else if (model.window.state === Mir.MaximizedBottomRightState) {
1044 } else if (model.window.state === Mir.MaximizedBottomRightState) {
1040 appDelegate.maximizeBottomRight();
1045 appDelegate.maximizeBottomRight();
1041 } else if (model.window.state === Mir.RestoredState) {
1046 } else if (model.window.state === Mir.RestoredState) {
1047+ if (appDelegate.fullscreen && appDelegate.prevWindowState != WindowStateStorage.WindowStateRestored) {
1048+ model.window.requestState(WindowStateStorage.toMirState(appDelegate.prevWindowState));
1042− appDelegate.restore();
1050+ appDelegate.restore();
1052+ } else if (model.window.state === Mir.FullscreenState) {
1053+ appDelegate.prevWindowState = appDelegate.windowState;
1054+ appDelegate.windowState = WindowStateStorage.WindowStateFullscreen;
@@ -1141,6 +1153,7 @@ FocusScope {
1141 animationsEnabled = (animated === undefined) || animated;
1153 animationsEnabled = (animated === undefined) || animated;
1142 windowState = state || WindowStateStorage.WindowStateRestored;
1154 windowState = state || WindowStateStorage.WindowStateRestored;
1143 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1155 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1156+ prevWindowState = windowState;
1146 function playFocusAnimation() {
1159 function playFocusAnimation() {
@@ -1303,7 +1316,7 @@ FocusScope {
1303 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
1316 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
1304 PropertyChanges {
1317 PropertyChanges {
1305 target: stagedRightEdgeMaths
1318 target: stagedRightEdgeMaths
1306− progress: Math.max(edgeBarrier.progress, rightEdgeDragArea.draggedProgress)
1319+ progress: Math.max(rightEdgePushProgress, rightEdgeDragArea.draggedProgress)
1308 PropertyChanges {
1321 PropertyChanges {
1309 target: appDelegate
1322 target: appDelegate
@@ -1330,11 +1343,11 @@ FocusScope {
1332 name: "windowedRightEdge"
1345 name: "windowedRightEdge"
1333− when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || edgeBarrier.progress > 0)
1346+ when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || rightEdgePushProgress > 0)
1334 PropertyChanges {
1347 PropertyChanges {
1335 target: windowedRightEdgeMaths
1348 target: windowedRightEdgeMaths
1336 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1349 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1337− pushProgress: edgeBarrier.progress
1350+ pushProgress: rightEdgePushProgress
1339 PropertyChanges {
1352 PropertyChanges {
1340 target: appDelegate
1353 target: appDelegate
@@ -1528,11 +1541,12 @@ FocusScope {
1528 name: "minimized"; when: appDelegate.minimized
1541 name: "minimized"; when: appDelegate.minimized
1529 PropertyChanges {
1542 PropertyChanges {
1530 target: appDelegate
1543 target: appDelegate
1531− requestedX: -appDelegate.width / 2
1532 scale: units.gu(5) / appDelegate.width
1544 scale: units.gu(5) / appDelegate.width
1533 opacity: 0;
1545 opacity: 0;
1534 visuallyMinimized: true
1546 visuallyMinimized: true
1535 visuallyMaximized: false
1547 visuallyMaximized: false
1548+ x: -appDelegate.width / 2
@@ -1548,15 +1562,6 @@ FocusScope {
1548 to: "staged,stagedWithSideStage"
1562 to: "staged,stagedWithSideStage"
1549 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1563 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1553− enabled: appDelegate.animationsEnabled
1554− PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1555− SequentialAnimation {
1556− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
1557− PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1560 Transition {
1565 Transition {
1561 to: "spread"
1566 to: "spread"
1562 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1567 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
@@ -1605,6 +1610,31 @@ FocusScope {
1605 PropertyAction { target: appDelegate; property: "visible" }
1610 PropertyAction { target: appDelegate; property: "visible" }
1614+ from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1616+ SequentialAnimation {
1617+ ScriptAction { script: print("transitioning:", appDelegate.x, appDelegate.y, appDelegate.scale) }
1618+ ScriptAction { script: { fakeRectangle.stop(); } }
1619+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1620+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,scale,opacity"; duration: priv.animationDuration }
1621+ PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1626+ to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1627+ SequentialAnimation {
1628+ ScriptAction { script: print("transitioning:", appDelegate.x, appDelegate.y, appDelegate.scale) }
1629+ PropertyAction { target: appDelegate; property: "visuallyMinimized,z" }
1630+ ParallelAnimation {
1631+ UbuntuNumberAnimation { target: appDelegate; properties: "x"; from: -appDelegate.width / 2; duration: priv.animationDuration }
1632+ UbuntuNumberAnimation { target: appDelegate; properties: "y,opacity"; duration: priv.animationDuration }
1633+ UbuntuNumberAnimation { target: appDelegate; properties: "scale"; from: 0; duration: priv.animationDuration }
1635+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1608 Transition {
1638 Transition {
1609 id: windowedTransition
1639 id: windowedTransition
1610 from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
1640 from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
@@ -1696,7 +1726,10 @@ FocusScope {
1696 onDecorationReleased: fakeRectangle.commit();
1726 onDecorationReleased: fakeRectangle.commit();
1698 property real angle: 0
1728 property real angle: 0
1729+ Behavior on angle { enabled: priv.closingIndex >= 0; UbuntuNumberAnimation {} }
1699 property real itemScale: 1
1730 property real itemScale: 1
1731+ Behavior on itemScale { enabled: priv.closingIndex >= 0; UbuntuNumberAnimation {} }
1700 transform: [
1733 transform: [
1702 origin.x: 0
1735 origin.x: 0
@@ -1758,7 +1791,6 @@ FocusScope {
1758 onClicked: {
1791 onClicked: {
1759 spreadItem.highlightedIndex = index;
1792 spreadItem.highlightedIndex = index;
1760 if (distance == 0) {
1793 if (distance == 0) {
1761− model.window.activate();
1762 priv.goneToSpread = false;
1794 priv.goneToSpread = false;
@@ -1867,30 +1899,6 @@ FocusScope {
1867 panelState: root.panelState
1899 panelState: root.panelState
1873− // NB: it does its own positioning according to the specified edge
1876− onPassed: priv.goneToSpread = true;
1878− material: Component {
1881− width: parent.height
1882− height: parent.width
1884− anchors.centerIn: parent
1885− gradient: Gradient {
1886− GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
1887− GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
1894 PropertyAnimation {
1902 PropertyAnimation {
1895 id: shortRightEdgeSwipeAnimation
1903 id: shortRightEdgeSwipeAnimation
1896 property: "x"
1904 property: "x"