Merge lp:~mzanetti/unity8/disable-spread-while-locked-stable into lp:unity8/stable

Proposed by Michael Zanetti
Status: Merged
Approved by: Michał Sawicz
Approved revision: 2680
Merged at revision: 2680
Proposed branch: lp:~mzanetti/unity8/disable-spread-while-locked-stable
Merge into: lp:unity8/stable
Diff against target: 110 lines (+54/-4)
3 files modified
qml/Shell.qml (+0/-2)
qml/Stage/Stage.qml (+8/-2)
tests/qmltests/tst_Shell.qml (+46/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/disable-spread-while-locked-stable
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
Review via email: mp+310768@code.launchpad.net

Commit message

Hotfix for not allowing to go to spread when locked

To post a comment you must log in.
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Change looks and works fine; tested on my krillin with mouse edge push, alt-tab and Meta+W keyboard shortcut

* Did you perform an exploratory manual test run of the code change and any related functionality?

Yes

* Did CI run pass? If not, please explain why.

Not yet, will wait with the top approval

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Shell.qml'
2--- qml/Shell.qml 2016-11-07 19:19:20 +0000
3+++ qml/Shell.qml 2016-11-14 12:12:08 +0000
4@@ -311,8 +311,6 @@
5 keepDashRunning: launcher.shown || launcher.dashSwipe
6 altTabPressed: physicalKeysMapper.altTabPressed
7 oskEnabled: shell.oskEnabled
8-
9- // TODO: This is not implemented yet in the new stage...
10 spreadEnabled: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
11 }
12 }
13
14=== modified file 'qml/Stage/Stage.qml'
15--- qml/Stage/Stage.qml 2016-11-09 14:58:26 +0000
16+++ qml/Stage/Stage.qml 2016-11-14 12:12:08 +0000
17@@ -92,7 +92,9 @@
18
19 onAltTabPressedChanged: {
20 if (altTabPressed) {
21- altTabDelayTimer.start();
22+ if (root.spreadEnabled) {
23+ altTabDelayTimer.start();
24+ }
25 } else {
26 // Alt Tab has been released, did we already go to spread?
27 if (priv.goneToSpread) {
28@@ -127,7 +129,9 @@
29 function updateFocusedAppOrientation() { /* TODO */ }
30 function updateFocusedAppOrientationAnimated() { /* TODO */}
31 function pushRightEdge(amount) {
32- edgeBarrier.push(amount);
33+ if (root.spreadEnabled) {
34+ edgeBarrier.push(amount);
35+ }
36 }
37
38 function closeSpread() {
39@@ -168,6 +172,7 @@
40 GlobalShortcut {
41 id: showSpreadShortcut
42 shortcut: Qt.MetaModifier|Qt.Key_W
43+ active: root.spreadEnabled
44 onTriggered: priv.goneToSpread = true
45 }
46
47@@ -1788,6 +1793,7 @@
48 direction: Direction.Leftwards
49 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
50 width: root.dragAreaWidth
51+ enabled: root.spreadEnabled
52
53 property var gesturePoints: []
54 property bool cancelled: false
55
56=== modified file 'tests/qmltests/tst_Shell.qml'
57--- tests/qmltests/tst_Shell.qml 2016-10-03 11:15:27 +0000
58+++ tests/qmltests/tst_Shell.qml 2016-11-14 12:12:08 +0000
59@@ -2761,5 +2761,51 @@
60 wait(3000);
61 tryCompare(cursor, "opacity", 0);
62 }
63+
64+ function test_spreadDisabled_data() {
65+ return [
66+ { tag: "enabled", spreadEnabled: true },
67+ { tag: "disabled", spreadEnabled: false }
68+ ]
69+ }
70+ function test_spreadDisabled(data) {
71+ loadShell("phone");
72+ swipeAwayGreeter();
73+ var stage = findChild(shell, "stage");
74+ stage.spreadEnabled = data.spreadEnabled;
75+
76+ // Try swiping
77+ touchFlick(shell, shell.width - 2, shell.height / 2, units.gu(1), shell.height / 2);
78+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
79+
80+ stage.closeSpread();
81+ tryCompare(stage, "state", "staged");
82+
83+ // Try by edge push
84+ mouseMove(stage, stage.width - 1, units.gu(10));
85+ for (var i = 0; i < units.gu(10); i++) {
86+ stage.pushRightEdge(1);
87+ }
88+ mouseMove(stage, stage.width - units.gu(5), units.gu(10));
89+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
90+
91+ stage.closeSpread();
92+ tryCompare(stage, "state", "staged");
93+
94+ // Try by alt+tab
95+ keyPress(Qt.Key_Alt);
96+ keyClick(Qt.Key_Tab);
97+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
98+ keyRelease(Qt.Key_Alt);
99+
100+ stage.closeSpread();
101+ tryCompare(stage, "state", "staged");
102+
103+ // Try by Super+W
104+ keyPress(Qt.Key_W, Qt.MetaModifier)
105+ tryCompare(stage, "state", data.spreadEnabled ? "spread" : "staged");
106+ keyRelease(Qt.Key_W, Qt.MetaModifier)
107+
108+ }
109 }
110 }

Subscribers

People subscribed via source and target branches

to all changes: