@@ -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"
@@ -453,7 +457,7 @@ FocusScope {
453 PropertyChanges { target: wallpaper; visible: false }
457 PropertyChanges { target: wallpaper; visible: false }
456− name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
460+ name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
457 PropertyChanges {
461 PropertyChanges {
458 target: blurLayer;
462 target: blurLayer;
459 visible: true;
463 visible: true;
@@ -463,7 +467,7 @@ FocusScope {
466− name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
470+ name: "sideStagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "stagedWithSideStage"
467 extend: "stagedRightEdge"
471 extend: "stagedRightEdge"
468 PropertyChanges {
472 PropertyChanges {
469 target: sideStage
473 target: sideStage
@@ -472,18 +476,18 @@ FocusScope {
475− name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
479+ name: "windowedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "windowed"
476 PropertyChanges {
480 PropertyChanges {
477 target: blurLayer;
481 target: blurLayer;
478 visible: true
482 visible: true
479 blurRadius: 32
483 blurRadius: 32
480 brightness: .65
484 brightness: .65
481− opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, edgeBarrier.progress))
485+ opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, rightEdgePushProgress))
485 name: "staged"; when: root.mode === "staged"
489 name: "staged"; when: root.mode === "staged"
486− PropertyChanges { target: wallpaper; visible: false }
490+ PropertyChanges { target: wallpaper; visible: !priv.focusedAppDelegate || priv.focusedAppDelegate.x !== 0 }
489 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
493 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
@@ -503,7 +507,6 @@ FocusScope {
503 Transition {
507 Transition {
504 to: "spread"
508 to: "spread"
505 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
509 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
506− PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
508 Transition {
511 Transition {
509 from: "spread"
512 from: "spread"
@@ -518,6 +521,7 @@ FocusScope {
520 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
523 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
524+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
523 Transition {
527 Transition {
@@ -669,7 +673,7 @@ FocusScope {
670 id: boundariesForWindowPlacement
674 id: boundariesForWindowPlacement
671 anchors.fill: parent
675 anchors.fill: parent
672− anchors.topMargin: PanelState.panelHeight
676+ anchors.topMargin: panelState.panelHeight
673 visible: false
677 visible: false
@@ -812,7 +816,7 @@ FocusScope {
812 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
816 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
814 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
818 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
815− readonly property bool fullscreen: window.state === Mir.FullscreenState
819+ readonly property bool fullscreen: windowState === WindowStateStorage.WindowStateFullscreen
817 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
821 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
818 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
822 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
@@ -823,7 +827,10 @@ FocusScope {
823 readonly property bool canBeMaximizedVertically: maximumHeight == 0 || maximumHeight >= appContainer.height
827 readonly property bool canBeMaximizedVertically: maximumHeight == 0 || maximumHeight >= appContainer.height
824 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
828 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
830+ // TODO drop our own windowType once Mir/Miral/Qtmir gets in sync with ours
826 property int windowState: WindowStateStorage.WindowStateNormal
831 property int windowState: WindowStateStorage.WindowStateNormal
832+ property int prevWindowState: WindowStateStorage.WindowStateRestored
827 property bool animationsEnabled: true
834 property bool animationsEnabled: true
828 property alias title: decoratedWindow.title
835 property alias title: decoratedWindow.title
829 readonly property string appName: model.application ? model.application.name : ""
836 readonly property string appName: model.application ? model.application.name : ""
@@ -878,9 +885,6 @@ FocusScope {
879 priv.updateMainAndSideStageIndexes();
886 priv.updateMainAndSideStageIndexes();
881− if (root.mode == "windowed") {
882− appDelegate.restore(true /* animated */, appDelegate.windowState);
884 appDelegate.focus = true;
888 appDelegate.focus = true;
@@ -930,7 +934,14 @@ FocusScope {
930 } else if (model.window.state === Mir.MaximizedBottomRightState) {
934 } else if (model.window.state === Mir.MaximizedBottomRightState) {
931 appDelegate.maximizeBottomRight();
935 appDelegate.maximizeBottomRight();
932 } else if (model.window.state === Mir.RestoredState) {
936 } else if (model.window.state === Mir.RestoredState) {
937+ if (appDelegate.fullscreen && appDelegate.prevWindowState != WindowStateStorage.WindowStateRestored) {
938+ model.window.requestState(WindowStateStorage.toMirState(appDelegate.prevWindowState));
933− appDelegate.restore();
940+ appDelegate.restore();
942+ } else if (model.window.state === Mir.FullscreenState) {
943+ appDelegate.prevWindowState = appDelegate.windowState;
944+ appDelegate.windowState = WindowStateStorage.WindowStateFullscreen;
@@ -1032,6 +1043,7 @@ FocusScope {
1032 animationsEnabled = (animated === undefined) || animated;
1043 animationsEnabled = (animated === undefined) || animated;
1033 windowState = state || WindowStateStorage.WindowStateRestored;
1044 windowState = state || WindowStateStorage.WindowStateRestored;
1034 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1045 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1046+ prevWindowState = windowState;
1037 function playFocusAnimation() {
1049 function playFocusAnimation() {
@@ -1194,7 +1206,7 @@ FocusScope {
1194 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
1206 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
1195 PropertyChanges {
1207 PropertyChanges {
1196 target: stagedRightEdgeMaths
1208 target: stagedRightEdgeMaths
1197− progress: Math.max(edgeBarrier.progress, rightEdgeDragArea.draggedProgress)
1209+ progress: Math.max(rightEdgePushProgress, rightEdgeDragArea.draggedProgress)
1199 PropertyChanges {
1211 PropertyChanges {
1200 target: appDelegate
1212 target: appDelegate
@@ -1221,11 +1233,11 @@ FocusScope {
1223 name: "windowedRightEdge"
1235 name: "windowedRightEdge"
1224− when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || edgeBarrier.progress > 0)
1236+ when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || rightEdgePushProgress > 0)
1225 PropertyChanges {
1237 PropertyChanges {
1226 target: windowedRightEdgeMaths
1238 target: windowedRightEdgeMaths
1227 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1239 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1228− pushProgress: edgeBarrier.progress
1240+ pushProgress: rightEdgePushProgress
1230 PropertyChanges {
1242 PropertyChanges {
1231 target: appDelegate
1243 target: appDelegate
@@ -1419,11 +1431,12 @@ FocusScope {
1419 name: "minimized"; when: appDelegate.minimized
1431 name: "minimized"; when: appDelegate.minimized
1420 PropertyChanges {
1432 PropertyChanges {
1421 target: appDelegate
1433 target: appDelegate
1422− requestedX: -appDelegate.width / 2
1423 scale: units.gu(5) / appDelegate.width
1434 scale: units.gu(5) / appDelegate.width
1424 opacity: 0;
1435 opacity: 0;
1425 visuallyMinimized: true
1436 visuallyMinimized: true
1426 visuallyMaximized: false
1437 visuallyMaximized: false
1438+ x: -appDelegate.width / 2
@@ -1439,15 +1452,6 @@ FocusScope {
1439 to: "staged,stagedWithSideStage"
1452 to: "staged,stagedWithSideStage"
1440 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1453 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
1444− enabled: appDelegate.animationsEnabled
1445− PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1446− SequentialAnimation {
1447− UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,opacity,scale,requestedWidth,requestedHeight" }
1448− PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1451 Transition {
1455 Transition {
1452 to: "spread"
1456 to: "spread"
1453 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
1457 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
@@ -1496,6 +1500,31 @@ FocusScope {
1496 PropertyAction { target: appDelegate; property: "visible" }
1500 PropertyAction { target: appDelegate; property: "visible" }
1504+ from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1506+ SequentialAnimation {
1507+ ScriptAction { script: print("transitioning:", appDelegate.x, appDelegate.y, appDelegate.scale) }
1508+ ScriptAction { script: { fakeRectangle.stop(); } }
1509+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1510+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,scale,opacity"; duration: priv.animationDuration }
1511+ PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1516+ to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1517+ SequentialAnimation {
1518+ ScriptAction { script: print("transitioning:", appDelegate.x, appDelegate.y, appDelegate.scale) }
1519+ PropertyAction { target: appDelegate; property: "visuallyMinimized,z" }
1520+ ParallelAnimation {
1521+ UbuntuNumberAnimation { target: appDelegate; properties: "x"; from: -appDelegate.width / 2; duration: priv.animationDuration }
1522+ UbuntuNumberAnimation { target: appDelegate; properties: "y,opacity"; duration: priv.animationDuration }
1523+ UbuntuNumberAnimation { target: appDelegate; properties: "scale"; from: 0; duration: priv.animationDuration }
1525+ PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1499 Transition {
1528 Transition {
1500 id: windowedTransition
1529 id: windowedTransition
1501 from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
1530 from: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen,minimized"
@@ -1587,7 +1616,10 @@ FocusScope {
1587 onDecorationReleased: fakeRectangle.commit();
1616 onDecorationReleased: fakeRectangle.commit();
1589 property real angle: 0
1618 property real angle: 0
1619+ Behavior on angle { enabled: priv.closingIndex >= 0; UbuntuNumberAnimation {} }
1590 property real itemScale: 1
1620 property real itemScale: 1
1621+ Behavior on itemScale { enabled: priv.closingIndex >= 0; UbuntuNumberAnimation {} }
1591 transform: [
1623 transform: [
1593 origin.x: 0
1625 origin.x: 0
@@ -1649,7 +1681,6 @@ FocusScope {
1649 onClicked: {
1681 onClicked: {
1650 spreadItem.highlightedIndex = index;
1682 spreadItem.highlightedIndex = index;
1651 if (distance == 0) {
1683 if (distance == 0) {
1652− model.window.activate();
1653 priv.goneToSpread = false;
1684 priv.goneToSpread = false;
@@ -1758,30 +1789,6 @@ FocusScope {
1758 panelState: root.panelState
1789 panelState: root.panelState
1764− // NB: it does its own positioning according to the specified edge
1767− onPassed: priv.goneToSpread = true;
1769− material: Component {
1772− width: parent.height
1773− height: parent.width
1775− anchors.centerIn: parent
1776− gradient: Gradient {
1777− GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
1778− GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
1785 MouseArea {
1792 MouseArea {
1786 id: hoverMouseArea
1793 id: hoverMouseArea
1787 objectName: "hoverMouseArea"
1794 objectName: "hoverMouseArea"
@@ -1848,11 +1855,11 @@ FocusScope {
1848 var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1855 var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1849 if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1856 if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1850 var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1857 var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1851− snapAnimation.to = floatingFlickable.contentX - offset;
1858+ snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1852 snapAnimation.start();
1859 snapAnimation.start();
1853 } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1860 } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1854 var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1861 var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1855− snapAnimation.to = floatingFlickable.contentX - offset;
1862+ snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1856 snapAnimation.start();
1863 snapAnimation.start();