@@ -37,8 +37,10 @@ AbstractStage {
40+ property string mode: "staged"
40 // Used by TutorialRight
42 // Used by TutorialRight
41− property bool spreadShown: spread.state == "altTab"
43+ property bool spreadShown: state == "altTab"
43 mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
45 mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
@@ -57,7 +59,7 @@ AbstractStage {
57 GlobalShortcut {
59 GlobalShortcut {
58 id: showSpreadShortcut
60 id: showSpreadShortcut
59 shortcut: Qt.MetaModifier|Qt.Key_W
61 shortcut: Qt.MetaModifier|Qt.Key_W
60− onTriggered: spread.state = "altTab"
62+ onTriggered: state = "altTab"
63 GlobalShortcut {
65 GlobalShortcut {
@@ -104,8 +106,8 @@ AbstractStage {
104 Connections {
106 Connections {
105 target: root.topLevelSurfaceList
107 target: root.topLevelSurfaceList
106 onCountChanged: {
108 onCountChanged: {
107− if (spread.state == "altTab") {
109+ if (root.state == "spread") {
108− spread.cancel();
110+ priv.goneToSpread = false;
@@ -116,13 +118,15 @@ AbstractStage {
117 property var focusedAppDelegate: null
119 property var focusedAppDelegate: null
118 onFocusedAppDelegateChanged: {
120 onFocusedAppDelegateChanged: {
119− if (spread.state == "altTab") {
121+ if (root.state == "spread") {
120− spread.state = "";
122+ goneToSpread = false;
124 property var foregroundMaximizedAppDelegate: null // for stuff like drop shadow and focusing maximized app by clicking panel
126 property var foregroundMaximizedAppDelegate: null // for stuff like drop shadow and focusing maximized app by clicking panel
128+ property bool goneToSpread: false
126 function updateForegroundMaximizedApp() {
130 function updateForegroundMaximizedApp() {
127 var found = false;
131 var found = false;
128 for (var i = 0; i < appRepeater.count && !found; i++) {
132 for (var i = 0; i < appRepeater.count && !found; i++) {
@@ -180,12 +184,12 @@ AbstractStage {
180 target: PanelState
184 target: PanelState
181 property: "title"
185 property: "title"
183− if (priv.focusedAppDelegate !== null && spread.state == "") {
187+// if (priv.focusedAppDelegate !== null && spread.state == "") {
184− if (priv.focusedAppDelegate.maximized)
188+// if (priv.focusedAppDelegate.maximized)
185− return priv.focusedAppDelegate.title
189+// return priv.focusedAppDelegate.title
187− return priv.focusedAppDelegate.appName
191+// return priv.focusedAppDelegate.appName
189 return ""
193 return ""
191 when: priv.focusedAppDelegate
195 when: priv.focusedAppDelegate
@@ -231,6 +235,25 @@ AbstractStage {
231 when: !appRepeater.startingUp && root.parent
235 when: !appRepeater.startingUp && root.parent
240+ name: "spread"; when: root.altTabPressed || priv.goneToSpread
243+ name: "stagedrightedge"; when: rightEdgeDragArea.dragging && root.mode == "staged"
246+ name: "windowedrightedge"; when: rightEdgeDragArea.dragging && root.mode == "windowed"
249+ name: "staged"; when: root.mode === "staged"
252+ name: "windowed"; when: root.mode === "windowed"
255+ onStateChanged: print("spread going to state:", state)
234 FocusScope {
257 FocusScope {
235 id: appContainer
258 id: appContainer
236 objectName: "appContainer"
259 objectName: "appContainer"
@@ -298,6 +321,8 @@ AbstractStage {
299 readonly property var surface: model.surface
322 readonly property var surface: model.surface
324+ property real angle: 0
301 function claimFocus() {
326 function claimFocus() {
302 if (spread.state == "altTab") {
327 if (spread.state == "altTab") {
303 spread.cancel();
328 spread.cancel();
@@ -378,7 +403,7 @@ AbstractStage {
378 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
403 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
380 || decoratedWindow.fullscreen
405 || decoratedWindow.fullscreen
381− || (spread.state == "altTab" && index === spread.highlightedIndex)
406+ // || (root.state == "altTab" && index === spread.highlightedIndex)
383 function close() {
408 function close() {
384 model.surface.close();
409 model.surface.close();
@@ -440,29 +465,80 @@ AbstractStage {
440 duration: UbuntuAnimation.SnapDuration
465 duration: UbuntuAnimation.SnapDuration
471+ totalItems: appRepeater.count
472+ flickable: floatingFlickable
474+ StagedRightEdgeMaths {
475+ id: stagedRightEdgeMaths
477+ sceneWidth: root.width
478+ sceneHeight: root.height
480+ targetX: spreadMaths.animatedX
481+ targetAngle: spreadMaths.animatedAngle
486+ origin.x: itemScaleOriginX
487+ origin.y: itemScaleOriginY
492+// origin { x: 0; y: (clippedSpreadDelegate.height - (clippedSpreadDelegate.height * itemScale / 2)) }
493+ axis { x: 0; y: 1; z: 0 }
494+ angle: appDelegate.angle
498+ onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
443 states: [
499 states: [
445− name: "fullscreen"; when: decoratedWindow.fullscreen && !appDelegate.minimized
501+ name: "spread"; when: root.state == "spread"
502+ PropertyChanges { target: appDelegate;
503+ x: spreadMaths.animatedX
504+ y: spreadMaths.animatedY
506+ angle: spreadMaths.animatedAngle
508+ PropertyChanges { target: decoratedWindow; showDecoration: false }
511+ name: "stagedrightedge"; when: root.state == "stagedrightedge"
446 PropertyChanges {
512 PropertyChanges {
513+ target: stagedRightEdgeMaths
514+ progress: rightEdgeDragArea.progress
447− target: appDelegate;
517+ target: appDelegate
449− y: -PanelState.panelHeight
518+ y: PanelState.panelHeight
450− requestedWidth: appContainer.width;
519+ x: stagedRightEdgeMaths.animatedX
451− requestedHeight: appContainer.height;
520+ requestedWidth: stagedRightEdgeMaths.animatedWidth
521+ requestedHeight: stagedRightEdgeMaths.animatedHeight
522+ angle: stagedRightEdgeMaths.animatedAngle
525+ PropertyChanges { target: decoratedWindow; showDecoration: false }
455− name: "normal";
528+ name: "staged"; when: root.state == "staged"
456− when: !appDelegate.maximized && !appDelegate.minimized
457− && !appDelegate.maximizedLeft && !appDelegate.maximizedRight
458 PropertyChanges {
529 PropertyChanges {
459− target: appDelegate;
530+ target: appDelegate
460− visuallyMinimized: false;
531+ x: 0; y: 0
461− visuallyMaximized: false
532+ visuallyMaximized: true
535+ target: decoratedWindow
536+ requestedWidth: appContainer.width - root.leftMargin;
537+ requestedHeight: appContainer.height;
465− name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
541+ name: "maximized"; when: root.state === "windowed" && appDelegate.maximized && !appDelegate.minimized
466 PropertyChanges {
542 PropertyChanges {
467 target: appDelegate;
543 target: appDelegate;
468 x: root.leftMargin;
544 x: root.leftMargin;
@@ -476,6 +552,26 @@ AbstractStage {
476 requestedHeight: appContainer.height;
552 requestedHeight: appContainer.height;
556+ name: "fullscreen"; when: decoratedWindow.fullscreen && !appDelegate.minimized
558+ target: appDelegate;
560+ y: -PanelState.panelHeight
561+ requestedWidth: appContainer.width;
562+ requestedHeight: appContainer.height;
567+ when: !appDelegate.maximized && !appDelegate.minimized
568+ && !appDelegate.maximizedLeft && !appDelegate.maximizedRight
570+ target: appDelegate;
571+ visuallyMinimized: false;
572+ visuallyMaximized: false
480 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
576 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
481 PropertyChanges {
577 PropertyChanges {
@@ -513,6 +609,7 @@ AbstractStage {
513 visuallyMaximized: false
609 visuallyMaximized: false
517 transitions: [
614 transitions: [
518 Transition {
615 Transition {
@@ -543,7 +640,7 @@ AbstractStage {
545 Transition {
642 Transition {
546− to: "*" //maximized and fullscreen
643+ to: "maximized,fullscreen" //maximized and fullscreen
547 enabled: appDelegate.animationsEnabled
644 enabled: appDelegate.animationsEnabled
548 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
645 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
549 SequentialAnimation {
646 SequentialAnimation {
@@ -553,16 +650,25 @@ AbstractStage {
554 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
651 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
656+ PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
660+ PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: UbuntuAnimation.FastDuration }
559− Binding {
665+// Binding {
560− id: previewBinding
666+// id: previewBinding
561− target: appDelegate
667+// target: appDelegate
562− property: "z"
668+// property: "z"
563− value: topLevelSurfaceList.count + 1
669+// value: topLevelSurfaceList.count + 1
564− when: index == spread.highlightedIndex && spread.ready
670+// when: index == spread.highlightedIndex
567 WindowResizeArea {
673 WindowResizeArea {
568 id: resizeArea
674 id: resizeArea
@@ -607,6 +713,7 @@ AbstractStage {
607 surface: model.surface
713 surface: model.surface
608 active: appDelegate.focus
714 active: appDelegate.focus
609 focus: true
715 focus: true
716+ showDecoration: true
611 requestedWidth: appDelegate.requestedWidth
718 requestedWidth: appDelegate.requestedWidth
612 requestedHeight: appDelegate.requestedHeight
719 requestedHeight: appDelegate.requestedHeight
@@ -650,23 +757,91 @@ AbstractStage {
761+ id: floatingFlickable
762+ anchors.fill: parent
764+ property int minContentWidth: 6 * Math.min(height / 4, width / 5)
765+ contentWidth: Math.max(6, appRepeater.count) * Math.min(height / 4, width / 5)
653 DirectionalDragArea {
769 DirectionalDragArea {
770+ id: rightEdgeDragArea
654 direction: Direction.Leftwards
771 direction: Direction.Leftwards
655 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
772 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
656− width: units.gu(1)
773+ width: root.dragAreaWidth
775+ property var gesturePoints: new Array()
777+ property real progress: -touchX / root.width
778+ onProgressChanged: print("dda progress", progress, root.width, touchX, root.width + touchX)
780+ Rectangle { color: "blue"; anchors.fill: parent }
657− onDraggingChanged: { if (dragging) { spread.show(); } }
782+ if (dragging) {
783+ // Gesture recognized. Let's move the spreadView with the finger
784+// var dragX = Math.min(touchX + width, width); // Prevent dragging rightwards
785+// dragX = -dragX + spreadDragArea.width - spreadView.shift;
786+// // Don't allow dragging further than the animation crossing with phase2's animation
787+// var maxMovement = spreadView.width * spreadView.positionMarker4 - spreadView.shift;
789+// spreadView.contentX = Math.min(dragX, maxMovement);
791+// // Initial touch. Let's reset the spreadView to the starting position.
792+// spreadView.phase = 0;
793+// spreadView.contentX = -spreadView.shift;
660− DesktopSpread {
796+ gesturePoints.push(touchX);
662− objectName: "spread"
663− anchors.fill: appContainer
664− workspace: appContainer
665− focus: state == "altTab"
666− altTabPressed: root.altTabPressed
668− onPlayFocusAnimation: {
799+ onDraggingChanged: {
669− appRepeater.itemAt(index).playFocusAnimation();
800+ print("dda dragging changed", dragging)
802+ // A potential edge-drag gesture has started. Start recording it
805+ if (gesturePoints[gesturePoints.length - 1] < -root.width / 2) {
806+ priv.goneToSpread = true;
809+// // Ok. The user released. Find out if it was a one-way movement.
810+// var oneWayFlick = true;
811+// var smallestX = spreadDragArea.width;
812+// for (var i = 0; i < gesturePoints.length; i++) {
813+// if (gesturePoints[i] >= smallestX) {
814+// oneWayFlick = false;
817+// smallestX = gesturePoints[i];
819+// gesturePoints = [];
821+// if (oneWayFlick && spreadView.shiftedContentX > units.gu(2) &&
822+// spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width) {
823+// // If it was a short one-way movement, do the Alt+Tab switch
824+// // no matter if we didn't cross positionMarker1 yet.
825+// spreadView.snapTo(1);
826+// } else if (!dragging) {
827+// // otherwise snap to the closest snap position we can find
828+// // (might be back to start, to app 1 or to spread)
829+// spreadView.snap();
837+// objectName: "spread"
838+// anchors.fill: appContainer
839+// workspace: appContainer
840+// focus: state == "altTab"
841+// altTabPressed: root.altTabPressed
843+// onPlayFocusAnimation: {
844+// appRepeater.itemAt(index).playFocusAnimation();