on xenial help sign in
Simplify behavior launcher/greeter/dash when doing a long-left-drag; now we never show dash while locked
3b68792Michael Terry
qml/Greeter/Greeter.qml+11−6
@@ -91,15 +91,18 @@ Showable {
91 d.startUnlock(false /* toTheRight */);
91 d.startUnlock(false /* toTheRight */);
92 }
92 }
93
93
94+ // This is a just a glorified notifyAboutToFocusApp(), but it does one
95+ // other thing: it hides any cover pages to the RIGHT, because the user
96+ // just came from a launcher drag starting on the left.
97+ // It also returns a boolean value, indicating whether there was a visual
98+ // change or not (the shell only wants to hide the launcher if there was
99+ // a change).
94 function notifyShowingDashFromDrag() {
100 function notifyShowingDashFromDrag() {
95 if (!active) {
101 if (!active) {
96− return;
102+ return false;
97 }
103 }
98
104
99− // This is a just a glorified notifyAboutToFocusApp(), but it does one
100− // other thing: it hides any cover pages to the RIGHT, because the user
101− // just came from a launcher drag starting on the left.
102− d.startUnlock(true /* toTheRight */);
105+ return d.startUnlock(true /* toTheRight */);
103 }
106 }
104
107
105 QtObject {
108 QtObject {
@@ -149,7 +152,9 @@ Showable {
149
152
150 function startUnlock(toTheRight) {
153 function startUnlock(toTheRight) {
151 if (loader.item) {
154 if (loader.item) {
152− loader.item.tryToUnlock(toTheRight);
155+ return loader.item.tryToUnlock(toTheRight);
156+ } else {
157+ return false;
153 }
158 }
154 }
159 }
155 }
160 }
qml/Greeter/NarrowView.qml+2
@@ -77,12 +77,14 @@ FocusScope {
77 }
77 }
78
78
79 function tryToUnlock(toTheRight) {
79 function tryToUnlock(toTheRight) {
80+ var coverChanged = coverPage.shown;
80 lockscreen.maybeShow();
81 lockscreen.maybeShow();
81 if (toTheRight) {
82 if (toTheRight) {
82 coverPage.hideRight();
83 coverPage.hideRight();
83 } else {
84 } else {
84 coverPage.hide();
85 coverPage.hide();
85 }
86 }
87+ return coverChanged;
86 }
88 }
87
89
88 onLockedChanged: {
90 onLockedChanged: {
qml/Greeter/WideView.qml+3
@@ -73,12 +73,15 @@ FocusScope {
73 if (root.locked) {
73 if (root.locked) {
74 coverPage.show();
74 coverPage.show();
75 loginList.tryToUnlock();
75 loginList.tryToUnlock();
76+ return false;
76 } else {
77 } else {
78+ var coverChanged = coverPage.shown;
77 if (toTheRight) {
79 if (toTheRight) {
78 coverPage.hideRight();
80 coverPage.hideRight();
79 } else {
81 } else {
80 coverPage.hide();
82 coverPage.hide();
81 }
83 }
84+ return coverChanged;
82 }
85 }
83 }
86 }
84
87
qml/Shell.qml+3−4
@@ -296,7 +296,7 @@ Item {
296 Binding {
296 Binding {
297 target: applicationsDisplayLoader.item
297 target: applicationsDisplayLoader.item
298 property: "inverseProgress"
298 property: "inverseProgress"
299− value: launcher.progress
299+ value: greeter.locked ? 0 : launcher.progress
300 }
300 }
301 Binding {
301 Binding {
302 target: applicationsDisplayLoader.item
302 target: applicationsDisplayLoader.item
@@ -447,12 +447,11 @@ Item {
447 }
447 }
448
448
449 function showDash() {
449 function showDash() {
450− if (greeter.active) {
450+ if (greeter.notifyShowingDashFromDrag()) {
451− greeter.notifyShowingDashFromDrag();
452 launcher.fadeOut();
451 launcher.fadeOut();
453 }
452 }
454
453
455− if (ApplicationManager.focusedApplicationId != "unity8-dash") {
454+ if (!greeter.locked && ApplicationManager.focusedApplicationId != "unity8-dash") {
456 ApplicationManager.requestFocusApplication("unity8-dash")
455 ApplicationManager.requestFocusApplication("unity8-dash")
457 launcher.fadeOut();
456 launcher.fadeOut();
458 }
457 }
tests/qmltests/Greeter/TestView.qml+1
@@ -83,6 +83,7 @@ Item {
83
83
84 function tryToUnlock(toTheRight) {
84 function tryToUnlock(toTheRight) {
85 _tryToUnlockCalled(toTheRight);
85 _tryToUnlockCalled(toTheRight);
86+ return true;
86 }
87 }
87
88
88 Rectangle {
89 Rectangle {
tests/qmltests/Greeter/tst_Greeter.qml+12
@@ -344,6 +344,18 @@ Item {
344 compare(view.background, Qt.resolvedUrl("testing"));
344 compare(view.background, Qt.resolvedUrl("testing"));
345 }
345 }
346
346
347+ function test_notifyAboutToFocusApp() {
348+ greeter.notifyAboutToFocusApp("fake-app");
349+ compare(viewTryToUnlockSpy.count, 1);
350+ compare(viewTryToUnlockSpy.signalArguments[0][0], false);
351+ }
352+
353+ function test_notifyShowingDashFromDrag() {
354+ compare(greeter.notifyShowingDashFromDrag("fake-app"), true);
355+ compare(viewTryToUnlockSpy.count, 1);
356+ compare(viewTryToUnlockSpy.signalArguments[0][0], true);
357+ }
358+
347 function test_dragHandleLeftMargin() {
359 function test_dragHandleLeftMargin() {
348 compare(view.dragHandleLeftMargin, 0);
360 compare(view.dragHandleLeftMargin, 0);
349 greeter.dragHandleLeftMargin = 5;
361 greeter.dragHandleLeftMargin = 5;
tests/qmltests/Greeter/tst_NarrowView.qml+8
@@ -402,6 +402,14 @@ Item {
402 tryCompare(view, "required", false);
402 tryCompare(view, "required", false);
403 }
403 }
404
404
405+ function test_tryToUnlock() {
406+ var coverPage = findChild(view, "coverPage");
407+ tryCompare(coverPage, "showProgress", 1);
408+ compare(view.tryToUnlock(false), true);
409+ tryCompare(coverPage, "showProgress", 0);
410+ compare(view.tryToUnlock(false), false);
411+ }
412+
405 /*
413 /*
406 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1388359
414 Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1388359
407 "User metrics can no longer be changed by double tap"
415 "User metrics can no longer be changed by double tap"
tests/qmltests/tst_Shell.qml+15−28
@@ -298,11 +298,13 @@ Item {
298
298
299 function test_leftEdgeDrag_data() {
299 function test_leftEdgeDrag_data() {
300 return [
300 return [
301− {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true},
301+ {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
302− {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true},
302+ {tag: "with launcher", revealLauncher: true, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
303+ {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: false},
304+ {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: false},
303− {tag: "small swipe", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false},
305+ {tag: "small swipe with greeter", revealLauncher: false, swipeLength: units.gu(25), appHides: false, focusedApp: "dialer-app", launcherHides: false, greeterShown: true},
304− {tag: "long swipe", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true},
306+ {tag: "long swipe with greeter", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true, greeterShown: true},
305− {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false}
307+ {tag: "swipe over dash", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "unity8-dash", launcherHides: false, greeterShown: false},
306 ];
308 ];
307 }
309 }
308
310
@@ -313,6 +315,12 @@ Item {
313 ApplicationManager.focusApplication(data.focusedApp)
315 ApplicationManager.focusApplication(data.focusedApp)
314 waitUntilApplicationWindowIsFullyVisible();
316 waitUntilApplicationWindowIsFullyVisible();
315
317
318+ var greeter = findChild(shell, "greeter");
319+ if (data.greeterShown) {
320+ LightDM.Greeter.showGreeter();
321+ tryCompare(greeter, "fullyShown", true);
322+ }
323+
316 if (data.revealLauncher) {
324 if (data.revealLauncher) {
317 dragLauncherIntoView();
325 dragLauncherIntoView();
318 }
326 }
@@ -320,8 +328,10 @@ Item {
320 swipeFromLeftEdge(data.swipeLength);
328 swipeFromLeftEdge(data.swipeLength);
321 if (data.appHides) {
329 if (data.appHides) {
322 waitUntilDashIsFocused();
330 waitUntilDashIsFocused();
331+ tryCompare(greeter, "shown", false);
323 } else {
332 } else {
324 waitUntilApplicationWindowIsFullyVisible();
333 waitUntilApplicationWindowIsFullyVisible();
334+ compare(greeter.fullyShown, data.greeterShown);
325 }
335 }
326
336
327 var launcher = findChild(shell, "launcherPanel");
337 var launcher = findChild(shell, "launcherPanel");
@@ -715,29 +725,6 @@ Item {
715 tryCompare(unlockAllModemsSpy, "count", 1)
725 tryCompare(unlockAllModemsSpy, "count", 1)
716 }
726 }
717
727
718− function test_leftEdgeDragOnGreeter_data() {
719− return [
720− {tag: "short swipe", targetX: shell.width / 3, unlocked: false},
721− {tag: "long swipe", targetX: shell.width / 3 * 2, unlocked: true}
722− ]
723− }
724−
725− function test_leftEdgeDragOnGreeter(data) {
726− var greeter = findChild(shell, "greeter");
727− LightDM.Greeter.showGreeter();
728− tryCompare(greeter, "fullyShown", true);
729−
730− var touchStartX = 2;
731− var touchStartY = shell.height / 2;
732− touchFlick(shell, touchStartX, touchStartY, data.targetX, touchStartY);
733−
734− if (data.unlocked) {
735− tryCompare(greeter, "shown", false);
736− } else {
737− tryCompare(greeter, "fullyShown", true);
738− }
739− }
740−
741 function test_tapOnRightEdgeReachesApplicationSurface() {
728 function test_tapOnRightEdgeReachesApplicationSurface() {
742 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
729 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
743 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
730 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
tests/qmltests/tst_ShellWithPin.qml+25
@@ -599,5 +599,30 @@ Item {
599 compare(launcherPanel.x, 0);
599 compare(launcherPanel.x, 0);
600 }
600 }
601 }
601 }
602+
603+ function test_longLeftEdgeDrags() {
604+ var coverPage = findChild(shell, "coverPage");
605+ var lockscreen = findChild(shell, "lockscreen");
606+ var launcher = findChild(shell, "launcherPanel");
607+ ApplicationManager.startApplication("gallery-app");
608+ tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
609+
610+ // Show greeter
611+ LightDM.Greeter.showGreeter();
612+ tryCompare(coverPage, "showProgress", 1);
613+
614+ // Swipe cover page away
615+ touchFlick(shell, 2, shell.height / 2, units.gu(27), shell.height / 2);
616+ tryCompare(launcher, "x", -launcher.width);
617+ tryCompare(coverPage, "showProgress", 0);
618+ compare(lockscreen.shown, true);
619+ compare(ApplicationManager.focusedApplicationId, "gallery-app");
620+
621+ // Now attempt a swipe on lockscreen
622+ touchFlick(shell, 2, shell.height / 2, units.gu(27), shell.height / 2);
623+ tryCompare(launcher, "x", 0);
624+ compare(lockscreen.shown, true);
625+ compare(ApplicationManager.focusedApplicationId, "gallery-app");
626+ }
602 }
627 }
603}
628}