on xenial help sign in
disable spread interaction while locked
commit717d499a0e30a29c02d356566ae3fe5684559360 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 14 Nov 2016, 12:56 (10 years ago) parent3893655
2 files changed+44−2
qml/Stage/Stage.qml+7−2 tests/qmltests/tst_Shell.qml+37
qml/Stage/Stage.qml+7−2
@@ -92,7 +92,9 @@ FocusScope {
9292
9393 onAltTabPressedChanged: {
9494 if (altTabPressed) {
95− altTabDelayTimer.start();
95+ if (root.spreadEnabled) {
96+ altTabDelayTimer.start();
97+ }
9698 } else {
9799 // Alt Tab has been released, did we already go to spread?
98100 if (priv.goneToSpread) {
@@ -127,7 +129,9 @@ FocusScope {
127129 function updateFocusedAppOrientation() { /* TODO */ }
128130 function updateFocusedAppOrientationAnimated() { /* TODO */}
129131 function pushRightEdge(amount) {
130− edgeBarrier.push(amount);
132+ if (root.spreadEnabled) {
133+ edgeBarrier.push(amount);
134+ }
131135 }
132136
133137 function closeSpread() {
@@ -1788,6 +1792,7 @@ FocusScope {
17881792 direction: Direction.Leftwards
17891793 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
17901794 width: root.dragAreaWidth
1795+ enabled: root.spreadEnabled
17911796
17921797 property var gesturePoints: []
17931798 property bool cancelled: false
tests/qmltests/tst_Shell.qml+37
@@ -2779,5 +2779,42 @@ Rectangle {
27792779
27802780 GSettingsController.setEnableLauncher(true);
27812781 }
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+ }
27822819 }
27832820}