on xenial help sign in
disable spread interaction while locked
717d499Michael Zanetti
qml/Stage/Stage.qml+7−2
@@ -92,7 +92,9 @@ FocusScope {
92
92
93 onAltTabPressedChanged: {
93 onAltTabPressedChanged: {
94 if (altTabPressed) {
94 if (altTabPressed) {
95+ if (root.spreadEnabled) {
95− altTabDelayTimer.start();
96+ altTabDelayTimer.start();
97+ }
96 } else {
98 } else {
97 // Alt Tab has been released, did we already go to spread?
99 // Alt Tab has been released, did we already go to spread?
98 if (priv.goneToSpread) {
100 if (priv.goneToSpread) {
@@ -127,7 +129,9 @@ FocusScope {
127 function updateFocusedAppOrientation() { /* TODO */ }
129 function updateFocusedAppOrientation() { /* TODO */ }
128 function updateFocusedAppOrientationAnimated() { /* TODO */}
130 function updateFocusedAppOrientationAnimated() { /* TODO */}
129 function pushRightEdge(amount) {
131 function pushRightEdge(amount) {
132+ if (root.spreadEnabled) {
130− edgeBarrier.push(amount);
133+ edgeBarrier.push(amount);
134+ }
131 }
135 }
132
136
133 function closeSpread() {
137 function closeSpread() {
@@ -1788,6 +1792,7 @@ FocusScope {
1788 direction: Direction.Leftwards
1792 direction: Direction.Leftwards
1789 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
1793 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
1790 width: root.dragAreaWidth
1794 width: root.dragAreaWidth
1795+ enabled: root.spreadEnabled
1791
1796
1792 property var gesturePoints: []
1797 property var gesturePoints: []
1793 property bool cancelled: false
1798 property bool cancelled: false
tests/qmltests/tst_Shell.qml+37
@@ -2779,5 +2779,42 @@ Rectangle {
2779
2779
2780 GSettingsController.setEnableLauncher(true);
2780 GSettingsController.setEnableLauncher(true);
2781 }
2781 }
2782+
2783+ function test_spreadDisabled_data() {
2784+ return [
2785+ { tag: "enabled", spreadEnabled: true },
2786+ { tag: "disabled", spreadEnabled: false }
2787+ ]
2788+ }
2789+ function test_spreadDisabled(data) {
2790+ loadShell("phone");
2791+ swipeAwayGreeter();
2792+ var stage = findChild(shell, "stage");
2793+ stage.spreadEnabled = data.spreadEnabled;
2794+
2795+ // Try swiping
2796+ touchFlick(shell, shell.width - 2, shell.height / 2, units.gu(1), shell.height / 2);
2797+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2798+
2799+ stage.closeSpread();
2800+ tryCompare(stage, "state", "staged");
2801+
2802+ // Try by edge push
2803+ mouseMove(stage, stage.width - 1, units.gu(10));
2804+ for (var i = 0; i < units.gu(10); i++) {
2805+ stage.pushRightEdge(1);
2806+ }
2807+ mouseMove(stage, stage.width - units.gu(5), units.gu(10));
2808+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2809+
2810+ stage.closeSpread();
2811+ tryCompare(stage, "state", "staged");
2812+
2813+ // Try by alt+tab
2814+ keyPress(Qt.Key_Alt);
2815+ keyClick(Qt.Key_Tab);
2816+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2817+ keyRelease(Qt.Key_Alt);
2818+ }
2782 }
2819 }
2783}
2820}