@@ -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
50 // Configuration
51 // Configuration
51 property string mode: "staged"
52 property string mode: "staged"
@@ -101,6 +102,8 @@ FocusScope {
101 // No we didn't, do a quick alt-tab
102 // No we didn't, do a quick alt-tab
102 if (appRepeater.count > 1) {
103 if (appRepeater.count > 1) {
103 appRepeater.itemAt(1).activate();
104 appRepeater.itemAt(1).activate();
105+ } else if (appRepeater.count > 0) {
106+ appRepeater.itemAt(0).activate(); // quick alt-tab to the only (minimized) window should still activate it
@@ -125,11 +128,6 @@ FocusScope {
125 // functions to be called from outside
128 // functions to be called from outside
126 function updateFocusedAppOrientation() { /* TODO */ }
129 function updateFocusedAppOrientation() { /* TODO */ }
127 function updateFocusedAppOrientationAnimated() { /* TODO */}
130 function updateFocusedAppOrientationAnimated() { /* TODO */}
128− function pushRightEdge(amount) {
129− if (root.spreadEnabled) {
130− edgeBarrier.push(amount);
134 function closeSpread() {
132 function closeSpread() {
135 priv.goneToSpread = false;
133 priv.goneToSpread = false;
@@ -141,6 +139,12 @@ FocusScope {
142+ onRightEdgePushProgressChanged: {
143+ if (spreadEnabled && rightEdgePushProgress >= 1) {
144+ priv.goneToSpread = true
144 GSettings {
148 GSettings {
145 id: lifecycleExceptions
149 id: lifecycleExceptions
146 schema.id: "com.canonical.qtmir"
150 schema.id: "com.canonical.qtmir"
@@ -452,7 +456,7 @@ FocusScope {
452 PropertyChanges { target: wallpaper; visible: false }
456 PropertyChanges { target: wallpaper; visible: false }
455− name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
459+ name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
456 PropertyChanges {
460 PropertyChanges {
457 target: blurLayer;
461 target: blurLayer;
458 visible: true;
462 visible: true;
@@ -462,7 +466,7 @@ FocusScope {
465− name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
469+ name: "sideStagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "stagedWithSideStage"
466 extend: "stagedRightEdge"
470 extend: "stagedRightEdge"
467 PropertyChanges {
471 PropertyChanges {
468 target: sideStage
472 target: sideStage
@@ -471,18 +475,18 @@ FocusScope {
474− name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
478+ name: "windowedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "windowed"
475 PropertyChanges {
479 PropertyChanges {
476 target: blurLayer;
480 target: blurLayer;
477 visible: true
481 visible: true
478 blurRadius: 32
482 blurRadius: 32
479 brightness: .65
483 brightness: .65
480− opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, edgeBarrier.progress))
484+ opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, rightEdgePushProgress))
484 name: "staged"; when: root.mode === "staged"
488 name: "staged"; when: root.mode === "staged"
485− PropertyChanges { target: wallpaper; visible: false }
489+ PropertyChanges { target: wallpaper; visible: !priv.focusedAppDelegate || priv.focusedAppDelegate.x !== 0 }
488 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
492 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
@@ -502,7 +506,6 @@ FocusScope {
502 Transition {
506 Transition {
503 to: "spread"
507 to: "spread"
504 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
508 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
505− PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
507 Transition {
510 Transition {
508 from: "spread"
511 from: "spread"
@@ -517,6 +520,7 @@ FocusScope {
519 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
522 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
523+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
522 Transition {
526 Transition {
@@ -811,7 +815,7 @@ FocusScope {
811 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
815 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
813 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
817 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
814− readonly property bool fullscreen: window.state === Mir.FullscreenState
818+ readonly property bool fullscreen: windowState === WindowStateStorage.WindowStateFullscreen
816 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
820 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
817 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
821 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
@@ -822,7 +826,10 @@ FocusScope {
822 readonly property bool canBeMaximizedVertically: maximumHeight == 0 || maximumHeight >= appContainer.height
826 readonly property bool canBeMaximizedVertically: maximumHeight == 0 || maximumHeight >= appContainer.height
823 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
827 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
829+ // TODO drop our own windowType once Mir/Miral/Qtmir gets in sync with ours
825 property int windowState: WindowStateStorage.WindowStateNormal
830 property int windowState: WindowStateStorage.WindowStateNormal
831+ property int prevWindowState: WindowStateStorage.WindowStateRestored
826 property bool animationsEnabled: true
833 property bool animationsEnabled: true
827 property alias title: decoratedWindow.title
834 property alias title: decoratedWindow.title
828 readonly property string appName: model.application ? model.application.name : ""
835 readonly property string appName: model.application ? model.application.name : ""
@@ -877,9 +884,6 @@ FocusScope {
878 priv.updateMainAndSideStageIndexes();
885 priv.updateMainAndSideStageIndexes();
880− if (root.mode == "windowed") {
881− appDelegate.restore(true /* animated */, appDelegate.windowState);
883 appDelegate.focus = true;
887 appDelegate.focus = true;
@@ -929,7 +933,14 @@ FocusScope {
929 } else if (model.window.state === Mir.MaximizedBottomRightState) {
933 } else if (model.window.state === Mir.MaximizedBottomRightState) {
930 appDelegate.maximizeBottomRight();
934 appDelegate.maximizeBottomRight();
931 } else if (model.window.state === Mir.RestoredState) {
935 } else if (model.window.state === Mir.RestoredState) {
936+ if (appDelegate.fullscreen && appDelegate.prevWindowState != WindowStateStorage.WindowStateRestored) {
937+ model.window.requestState(WindowStateStorage.toMirState(appDelegate.prevWindowState));
932− appDelegate.restore();
939+ appDelegate.restore();
941+ } else if (model.window.state === Mir.FullscreenState) {
942+ appDelegate.prevWindowState = appDelegate.windowState;
943+ appDelegate.windowState = WindowStateStorage.WindowStateFullscreen;
@@ -1031,6 +1042,7 @@ FocusScope {
1031 animationsEnabled = (animated === undefined) || animated;
1042 animationsEnabled = (animated === undefined) || animated;
1032 windowState = state || WindowStateStorage.WindowStateRestored;
1043 windowState = state || WindowStateStorage.WindowStateRestored;
1033 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1044 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1045+ prevWindowState = windowState;
1036 function playFocusAnimation() {
1048 function playFocusAnimation() {
@@ -1193,7 +1205,7 @@ FocusScope {
1193 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
1205 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
1194 PropertyChanges {
1206 PropertyChanges {
1195 target: stagedRightEdgeMaths
1207 target: stagedRightEdgeMaths
1196− progress: Math.max(edgeBarrier.progress, rightEdgeDragArea.draggedProgress)
1208+ progress: Math.max(rightEdgePushProgress, rightEdgeDragArea.draggedProgress)
1198 PropertyChanges {
1210 PropertyChanges {
1199 target: appDelegate
1211 target: appDelegate
@@ -1220,11 +1232,11 @@ FocusScope {
1222 name: "windowedRightEdge"
1234 name: "windowedRightEdge"
1223− when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || edgeBarrier.progress > 0)
1235+ when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || rightEdgePushProgress > 0)
1224 PropertyChanges {
1236 PropertyChanges {
1225 target: windowedRightEdgeMaths
1237 target: windowedRightEdgeMaths
1226 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1238 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1227− pushProgress: edgeBarrier.progress
1239+ pushProgress: rightEdgePushProgress
1229 PropertyChanges {
1241 PropertyChanges {
1230 target: appDelegate
1242 target: appDelegate
@@ -1418,11 +1430,12 @@ FocusScope {
1418 name: "minimized"; when: appDelegate.minimized
1430 name: "minimized"; when: appDelegate.minimized
1419 PropertyChanges {
1431 PropertyChanges {
1420 target: appDelegate
1432 target: appDelegate
1421− requestedX: -appDelegate.width / 2
1422 scale: units.gu(5) / appDelegate.width
1433 scale: units.gu(5) / appDelegate.width
1423 opacity: 0;
1434 opacity: 0;
1424 visuallyMinimized: true
1435 visuallyMinimized: true
1425 visuallyMaximized: false
1436 visuallyMaximized: false
1437+ x: -appDelegate.width / 2
@@ -1438,15 +1451,6 @@ FocusScope {
1438 to: "staged,stagedWithSideStage"
1451 to: "staged,stagedWithSideStage"
1439 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1452 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1443− enabled: appDelegate.animationsEnabled
1444− PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1445− SequentialAnimation {
1446− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
1447− PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1450 Transition {
1454 Transition {
1451 to: "spread"
1455 to: "spread"
1452 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1456 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
@@ -1495,6 +1499,31 @@ FocusScope {
1495 PropertyAction { target: appDelegate; property: "visible" }
1499 PropertyAction { target: appDelegate; property: "visible" }
1503+ from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1505+ SequentialAnimation {
1506+ ScriptAction { script: print("transitioning:", appDelegate.x, appDelegate.y, appDelegate.scale) }
1507+ ScriptAction { script: { fakeRectangle.stop(); } }
1508+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1509+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,scale,opacity"; duration: priv.animationDuration }
1510+ PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1515+ to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1516+ SequentialAnimation {
1517+ ScriptAction { script: print("transitioning:", appDelegate.x, appDelegate.y, appDelegate.scale) }
1518+ PropertyAction { target: appDelegate; property: "visuallyMinimized,z" }
1519+ ParallelAnimation {
1520+ UbuntuNumberAnimation { target: appDelegate; properties: "x"; from: -appDelegate.width / 2; duration: priv.animationDuration }
1521+ UbuntuNumberAnimation { target: appDelegate; properties: "y,opacity"; duration: priv.animationDuration }
1522+ UbuntuNumberAnimation { target: appDelegate; properties: "scale"; from: 0; duration: priv.animationDuration }
1524+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1498 Transition {
1527 Transition {
1499 id: windowedTransition
1528 id: windowedTransition
1500 from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
1529 from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
@@ -1586,7 +1615,10 @@ FocusScope {
1586 onDecorationReleased: fakeRectangle.commit();
1615 onDecorationReleased: fakeRectangle.commit();
1588 property real angle: 0
1617 property real angle: 0
1618+ Behavior on angle { enabled: priv.closingIndex >= 0; UbuntuNumberAnimation {} }
1589 property real itemScale: 1
1619 property real itemScale: 1
1620+ Behavior on itemScale { enabled: priv.closingIndex >= 0; UbuntuNumberAnimation {} }
1590 transform: [
1622 transform: [
1592 origin.x: 0
1624 origin.x: 0
@@ -1648,7 +1680,6 @@ FocusScope {
1648 onClicked: {
1680 onClicked: {
1649 spreadItem.highlightedIndex = index;
1681 spreadItem.highlightedIndex = index;
1650 if (distance == 0) {
1682 if (distance == 0) {
1651− model.window.activate();
1652 priv.goneToSpread = false;
1683 priv.goneToSpread = false;
@@ -1756,30 +1787,6 @@ FocusScope {
1756 appContainerHeight: appContainer.height
1787 appContainerHeight: appContainer.height
1762− // NB: it does its own positioning according to the specified edge
1765− onPassed: priv.goneToSpread = true;
1767− material: Component {
1770− width: parent.height
1771− height: parent.width
1773− anchors.centerIn: parent
1774− gradient: Gradient {
1775− GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
1776− GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
1783 MouseArea {
1790 MouseArea {
1784 id: hoverMouseArea
1791 id: hoverMouseArea
1785 objectName: "hoverMouseArea"
1792 objectName: "hoverMouseArea"
@@ -1846,11 +1853,11 @@ FocusScope {
1846 var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1853 var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1847 if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1854 if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1848 var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1855 var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1849− snapAnimation.to = floatingFlickable.contentX - offset;
1856+ snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1850 snapAnimation.start();
1857 snapAnimation.start();
1851 } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1858 } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1852 var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1859 var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1853− snapAnimation.to = floatingFlickable.contentX - offset;
1860+ snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1854 snapAnimation.start();
1861 snapAnimation.start();