on xenial help sign in
disable spread interaction while locked (LP: #1641578)

Approved by: Lukáš Tinkl, Unity8 CI Bot

commit57d1d88dc21ca58d5695a33903695872508a2846 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 29 Nov 2016, 09:39 (10 years ago) parent15e940b4a6366f
3 files changed+54−4
qml/Shell.qml−2 qml/Stage/Stage.qml+8−2 tests/qmltests/tst_Shell.qml+46
qml/Shell.qml−2
@@ -311,8 +311,6 @@ StyledItem {
311311 keepDashRunning: launcher.shown || launcher.dashSwipe
312312 altTabPressed: physicalKeysMapper.altTabPressed
313313 oskEnabled: shell.oskEnabled
314−
315− // TODO: This is not implemented yet in the new stage...
316314 spreadEnabled: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
317315 }
318316 }
qml/Stage/Stage.qml+8−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() {
@@ -168,6 +172,7 @@ FocusScope {
168172 GlobalShortcut {
169173 id: showSpreadShortcut
170174 shortcut: Qt.MetaModifier|Qt.Key_W
175+ active: root.spreadEnabled
171176 onTriggered: priv.goneToSpread = true
172177 }
173178
@@ -1800,6 +1805,7 @@ FocusScope {
18001805 direction: Direction.Leftwards
18011806 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
18021807 width: root.dragAreaWidth
1808+ enabled: root.spreadEnabled
18031809
18041810 property var gesturePoints: []
18051811 property bool cancelled: false
tests/qmltests/tst_Shell.qml+46
@@ -2797,5 +2797,51 @@ Rectangle {
27972797
27982798 GSettingsController.setEnableIndicatorMenu(true);
27992799 }
2800+
2801+ function test_spreadDisabled_data() {
2802+ return [
2803+ { tag: "enabled", spreadEnabled: true },
2804+ { tag: "disabled", spreadEnabled: false }
2805+ ];
2806+ }
2807+
2808+ function test_spreadDisabled(data) {
2809+ loadShell("phone");
2810+ swipeAwayGreeter();
2811+ var stage = findChild(shell, "stage");
2812+ stage.spreadEnabled = data.spreadEnabled;
2813+
2814+ // Try swiping
2815+ touchFlick(shell, shell.width - 2, shell.height / 2, units.gu(1), shell.height / 2);
2816+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2817+
2818+ stage.closeSpread();
2819+ tryCompare(stage, "state", "staged");
2820+
2821+ // Try by edge push
2822+ mouseMove(stage, stage.width - 1, units.gu(10));
2823+ for (var i = 0; i < units.gu(10); i++) {
2824+ stage.pushRightEdge(1);
2825+ }
2826+ mouseMove(stage, stage.width - units.gu(5), units.gu(10));
2827+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2828+
2829+ stage.closeSpread();
2830+ tryCompare(stage, "state", "staged");
2831+
2832+ // Try by alt+tab
2833+ keyPress(Qt.Key_Alt);
2834+ keyClick(Qt.Key_Tab);
2835+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2836+ keyRelease(Qt.Key_Alt);
2837+
2838+ stage.closeSpread();
2839+ tryCompare(stage, "state", "staged");
2840+
2841+ // Try by Super+W
2842+ keyPress(Qt.Key_W, Qt.MetaModifier)
2843+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
2844+ keyRelease(Qt.Key_W, Qt.MetaModifier)
2845+ }
28002846 }
28012847}