on xenial help sign in
move right edge push area up some levels so it can be used on top of the indicators
32b9b6eMichael Zanetti
qml/Components/EdgeBarrierController.qml+1
@@ -34,6 +34,7 @@ MouseArea {
34
34
35 function push(amount) {
35 function push(amount) {
36 if (!root._containsMouse) {
36 if (!root._containsMouse) {
37+ console.warn("pushing right edge without mouse actually being at right edge!")
37 return;
38 return;
38 }
39 }
39
40
qml/Shell.qml+29−1
@@ -288,6 +288,7 @@ StyledItem {
288 applicationManager: ApplicationManager
288 applicationManager: ApplicationManager
289 topLevelSurfaceList: topLevelSurfaceList
289 topLevelSurfaceList: topLevelSurfaceList
290 inputMethodRect: inputMethod.visibleRect
290 inputMethodRect: inputMethod.visibleRect
291+ rightEdgePushProgress: rightEdgeBarrier.progress
291
292
292 property string usageScenario: shell.usageScenario === "phone" || greeter.hasLockedApp
293 property string usageScenario: shell.usageScenario === "phone" || greeter.hasLockedApp
293 ? "phone"
294 ? "phone"
@@ -694,6 +695,33 @@ StyledItem {
694 }
695 }
695 ]
696 ]
696 }
697 }
698+
699+ EdgeBarrier {
700+ id: rightEdgeBarrier
701+ enabled: !greeter.shown
702+
703+ // NB: it does its own positioning according to the specified edge
704+ edge: Qt.RightEdge
705+
706+ onPassed: {
707+ panel.indicators.hide()
708+ }
709+
710+ material: Component {
711+ Item {
712+ Rectangle {
713+ width: parent.height
714+ height: parent.width
715+ rotation: 90
716+ anchors.centerIn: parent
717+ gradient: Gradient {
718+ GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
719+ GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
720+ }
721+ }
722+ }
723+ }
724+ }
697 }
725 }
698
726
699 Dialogs {
727 Dialogs {
@@ -777,7 +805,7 @@ StyledItem {
777
805
778 onPushedRightBoundary: {
806 onPushedRightBoundary: {
779 if (buttons === Qt.NoButton) {
807 if (buttons === Qt.NoButton) {
780− stage.pushRightEdge(amount);
808+ rightEdgeBarrier.push(amount);
781 } else if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeMaximizedLeftRight) {
809 } else if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeMaximizedLeftRight) {
782 previewRectangle.maximizeRight(amount);
810 previewRectangle.maximizeRight(amount);
783 }
811 }
qml/Stage/Stage.qml+14−36
@@ -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
50
50 // Configuration
51 // Configuration
51 property string mode: "staged"
52 property string mode: "staged"
@@ -127,11 +128,6 @@ FocusScope {
127 // functions to be called from outside
128 // functions to be called from outside
128 function updateFocusedAppOrientation() { /* TODO */ }
129 function updateFocusedAppOrientation() { /* TODO */ }
129 function updateFocusedAppOrientationAnimated() { /* TODO */}
130 function updateFocusedAppOrientationAnimated() { /* TODO */}
130− function pushRightEdge(amount) {
131− if (root.spreadEnabled) {
132− edgeBarrier.push(amount);
133− }
134− }
135
131
136 function closeSpread() {
132 function closeSpread() {
137 priv.goneToSpread = false;
133 priv.goneToSpread = false;
@@ -143,6 +139,12 @@ FocusScope {
143 }
139 }
144 }
140 }
145
141
142+ onRightEdgePushProgressChanged: {
143+ if (spreadEnabled && rightEdgePushProgress >= 1) {
144+ priv.goneToSpread = true
145+ }
146+ }
147+
146 GSettings {
148 GSettings {
147 id: lifecycleExceptions
149 id: lifecycleExceptions
148 schema.id: "com.canonical.qtmir"
150 schema.id: "com.canonical.qtmir"
@@ -454,7 +456,7 @@ FocusScope {
454 PropertyChanges { target: wallpaper; visible: false }
456 PropertyChanges { target: wallpaper; visible: false }
455 },
457 },
456 State {
458 State {
457− name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
459+ name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
458 PropertyChanges {
460 PropertyChanges {
459 target: blurLayer;
461 target: blurLayer;
460 visible: true;
462 visible: true;
@@ -464,7 +466,7 @@ FocusScope {
464 }
466 }
465 },
467 },
466 State {
468 State {
467− name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
469+ name: "sideStagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "stagedWithSideStage"
468 extend: "stagedRightEdge"
470 extend: "stagedRightEdge"
469 PropertyChanges {
471 PropertyChanges {
470 target: sideStage
472 target: sideStage
@@ -473,13 +475,13 @@ FocusScope {
473 }
475 }
474 },
476 },
475 State {
477 State {
476− name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
478+ name: "windowedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "windowed"
477 PropertyChanges {
479 PropertyChanges {
478 target: blurLayer;
480 target: blurLayer;
479 visible: true
481 visible: true
480 blurRadius: 32
482 blurRadius: 32
481 brightness: .65
483 brightness: .65
482− 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))
483 }
485 }
484 },
486 },
485 State {
487 State {
@@ -1203,7 +1205,7 @@ FocusScope {
1203 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)
1204 PropertyChanges {
1206 PropertyChanges {
1205 target: stagedRightEdgeMaths
1207 target: stagedRightEdgeMaths
1206− progress: Math.max(edgeBarrier.progress, rightEdgeDragArea.draggedProgress)
1208+ progress: Math.max(rightEdgePushProgress, rightEdgeDragArea.draggedProgress)
1207 }
1209 }
1208 PropertyChanges {
1210 PropertyChanges {
1209 target: appDelegate
1211 target: appDelegate
@@ -1230,11 +1232,11 @@ FocusScope {
1230 },
1232 },
1231 State {
1233 State {
1232 name: "windowedRightEdge"
1234 name: "windowedRightEdge"
1233− 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)
1234 PropertyChanges {
1236 PropertyChanges {
1235 target: windowedRightEdgeMaths
1237 target: windowedRightEdgeMaths
1236 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1238 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1237− pushProgress: edgeBarrier.progress
1239+ pushProgress: rightEdgePushProgress
1238 }
1240 }
1239 PropertyChanges {
1241 PropertyChanges {
1240 target: appDelegate
1242 target: appDelegate
@@ -1766,30 +1768,6 @@ FocusScope {
1766 appContainerHeight: appContainer.height
1768 appContainerHeight: appContainer.height
1767 }
1769 }
1768
1770
1769− EdgeBarrier {
1770− id: edgeBarrier
1771−
1772− // NB: it does its own positioning according to the specified edge
1773− edge: Qt.RightEdge
1774−
1775− onPassed: priv.goneToSpread = true;
1776−
1777− material: Component {
1778− Item {
1779− Rectangle {
1780− width: parent.height
1781− height: parent.width
1782− rotation: 90
1783− anchors.centerIn: parent
1784− gradient: Gradient {
1785− GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
1786− GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
1787− }
1788− }
1789− }
1790− }
1791− }
1792−
1793 MouseArea {
1771 MouseArea {
1794 id: hoverMouseArea
1772 id: hoverMouseArea
1795 objectName: "hoverMouseArea"
1773 objectName: "hoverMouseArea"
tests/qmltests/Stage/tst_DesktopStage.qml+16−6
@@ -92,7 +92,6 @@ Item {
92 focus: true
92 focus: true
93
93
94 Component.onCompleted: {
94 Component.onCompleted: {
95− edgeBarrierControls.target = testCase.findChild(this, "edgeBarrierController");
96 ApplicationManager.startApplication("unity8-dash");
95 ApplicationManager.startApplication("unity8-dash");
97 }
96 }
98 Component.onDestruction: {
97 Component.onDestruction: {
@@ -135,11 +134,22 @@ Item {
135 }
134 }
136 }
135 }
137
136
138− EdgeBarrierControls {
137+ Label {
139− id: edgeBarrierControls
138+ text: "Right edge push progress"
140− text: "Drag here to pull out spread"
139+ }
141− backgroundColor: "blue"
140+
142− onDragged: { stageLoader.item.pushRightEdge(amount); }
141+ Slider {
142+ id: rightEdgePushSlider
143+ width: parent.width
144+ live: true
145+ minimumValue: 0.0
146+ maximumValue: 1.0
147+ onPressedChanged: {
148+ if (!pressed) {
149+ value = 0;
150+ }
151+ }
152+ Binding { target: stageLoader.item; property: "rightEdgePushProgress"; value: rightEdgePushSlider.value }
143 }
153 }
144
154
145 Divider {}
155 Divider {}
tests/qmltests/Stage/tst_PhoneStage.qml+4−5
@@ -418,11 +418,10 @@ Item {
418
418
419 function test_mouseEdgePush() {
419 function test_mouseEdgePush() {
420 addApps(1);
420 addApps(1);
421− mouseMove(stage, stage.width - 1, units.gu(10));
421+ // When progress goes to 1 it should switch to spread, but stay there even if progress goes back
422− for (var i = 0; i < units.gu(10); i++) {
422+ stage.rightEdgePushProgress = 1;
423− stage.pushRightEdge(1);
423+ compare(stage.state, "spread");
424− }
424+ stage.rightEdgePushProgress = 0;
425− mouseMove(stage, stage.width - units.gu(5), units.gu(10));
426 compare(stage.state, "spread");
425 compare(stage.state, "spread");
427 }
426 }
428
427
tests/qmltests/Tutorial/tst_Tutorial.qml+2−2
@@ -719,9 +719,9 @@ Rectangle {
719 ApplicationManager.startApplication("facebook-webapp");
719 ApplicationManager.startApplication("facebook-webapp");
720 tryCompare(tutorialRightLoader, "shown", true);
720 tryCompare(tutorialRightLoader, "shown", true);
721
721
722− var stage = findChild(shell, "stage");
722+ var cursor = findChild(shell, "cursor");
723 mouseMove(shell, shell.width, shell.height / 2);
723 mouseMove(shell, shell.width, shell.height / 2);
724− stage.pushRightEdge(units.gu(8));
724+ cursor.pushedRightBoundary(units.gu(8), 0);
725 tryCompare(tutorialRightLoader, "shown", false);
725 tryCompare(tutorialRightLoader, "shown", false);
726
726
727 tryCompare(AccountsService, "demoEdges", false);
727 tryCompare(AccountsService, "demoEdges", false);
tests/qmltests/tst_Shell.qml+51−1
@@ -2587,6 +2587,55 @@ Rectangle {
2587 tryCompareFunction(function() { return ApplicationManager.focusedApplicationId; }, "calendar-app");
2587 tryCompareFunction(function() { return ApplicationManager.focusedApplicationId; }, "calendar-app");
2588 }
2588 }
2589
2589
2590+ function test_rightEdgePushWithOpenIndicators() {
2591+ loadShell("desktop");
2592+ shell.usageScenario = "desktop";
2593+ waitForRendering(shell);
2594+ swipeAwayGreeter();
2595+
2596+ var stage = findChild(shell, "stage");
2597+ var cursor = findChild(shell, "cursor");
2598+ var indicators = findChild(shell, "indicators");
2599+
2600+ // Open indicators
2601+ var touchX = shell.width - units.gu(5);
2602+ touchFlick(shell,
2603+ touchX /* fromX */, indicators.minimizedPanelHeight * 0.5 /* fromY */,
2604+ touchX /* toX */, shell.height * 0.9 /* toY */,
2605+ true /* beginTouch */, true /* endTouch */);
2606+ tryCompare(indicators, "fullyOpened", true);
2607+
2608+ // push the right edge
2609+ mouseMove(shell, shell.width - 1, units.gu(10));
2610+ for (var i = 0; i < units.gu(10); i++) {
2611+ cursor.pushedRightBoundary(1, 0);
2612+ }
2613+ tryCompare(stage, "rightEdgePushProgress", 1);
2614+ tryCompare(stage, "state", "spread");
2615+ tryCompare(indicators, "fullyOpened", false);
2616+
2617+ mouseMove(shell, shell.width - units.gu(5), units.gu(10));
2618+
2619+ tryCompare(stage, "rightEdgePushProgress", 0);
2620+ }
2621+
2622+ function test_rightEdgePushOnGreeter() {
2623+ loadShell("desktop");
2624+ shell.usageScenario = "desktop";
2625+ waitForRendering(shell);
2626+
2627+ var stage = findChild(shell, "stage");
2628+ var cursor = findChild(shell, "cursor");
2629+
2630+ // push the right edge, but verify it doesn't emit any progress
2631+ mouseMove(shell, shell.width - 1, units.gu(10));
2632+ for (var i = 0; i < units.gu(10); i++) {
2633+ cursor.pushedRightBoundary(1, 0);
2634+ compare(stage.rightEdgePushProgress, 0);
2635+ }
2636+ compare(stage.rightEdgePushProgress, 0);
2637+ }
2638+
2590 function test_oskDisplacesWindow_data() {
2639 function test_oskDisplacesWindow_data() {
2591 return [
2640 return [
2592 {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5), oskEnabled: true},
2641 {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5), oskEnabled: true},
@@ -2709,9 +2758,10 @@ Rectangle {
2709 tryCompare(stage, "state", "staged");
2758 tryCompare(stage, "state", "staged");
2710
2759
2711 // Try by edge push
2760 // Try by edge push
2761+ var cursor = findChild(shell, "cursor");
2712 mouseMove(stage, stage.width - 1, units.gu(10));
2762 mouseMove(stage, stage.width - 1, units.gu(10));
2713 for (var i = 0; i < units.gu(10); i++) {
2763 for (var i = 0; i < units.gu(10); i++) {
2714− stage.pushRightEdge(1);
2764+ cursor.pushedRightBoundary(1, 0);
2715 }
2765 }
2716 mouseMove(stage, stage.width - units.gu(5), units.gu(10));
2766 mouseMove(stage, stage.width - units.gu(5), units.gu(10));
2717 tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2767 tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");