on xenial help sign in
fix visual glitch when hiding the drawer with launcher locked visible, add a test
19bfe13Michael Zanetti
qml/Launcher/Launcher.qml+9−10
@@ -116,7 +116,14 @@ FocusScope {
116 if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
116 if ((flags & ignoreHideIfMouseOverLauncher) && Utils.Functions.itemUnderMouse(panel)) {
117 return;
117 return;
118 }
118 }
119+ if (root.lockedVisible) {
120+ // Due to binding updates when switching between modes
121+ // it could happen that our request to show will be overwritten
122+ // with a hide request. Rewrite it when we know hiding is not allowed.
123+ switchToNextState("visible")
124+ } else {
119− switchToNextState("")
125+ switchToNextState("")
126+ }
120 }
127 }
121
128
122 function fadeOut() {
129 function fadeOut() {
@@ -254,13 +261,6 @@ FocusScope {
254 interval: 1
261 interval: 1
255 property string nextState: ""
262 property string nextState: ""
256 onTriggered: {
263 onTriggered: {
257− if (root.lockedVisible && nextState == "") {
258− // Due to binding updates when switching between modes
259− // it could happen that our request to show will be overwritten
260− // with a hide request. Rewrite it when we know hiding is not allowed.
261− nextState = "visible"
262− }
263−
264 // switching to an intermediate state here to make sure all the
264 // switching to an intermediate state here to make sure all the
265 // values are restored, even if we were already in the target state
265 // values are restored, even if we were already in the target state
266 root.state = "tmp"
266 root.state = "tmp"
@@ -379,8 +379,7 @@ FocusScope {
379 }
379 }
380
380
381 Keys.onEscapePressed: {
381 Keys.onEscapePressed: {
382− switchToNextState("");
382+ root.hide()
383− root.focus = false;
384 }
383 }
385
384
386 onDragDistanceChanged: {
385 onDragDistanceChanged: {
tests/qmltests/Launcher/tst_Drawer.qml+18
@@ -311,5 +311,23 @@ StyledItem {
311
311
312 compare(launcher.lastSelectedApplication, "calendar-app");
312 compare(launcher.lastSelectedApplication, "calendar-app");
313 }
313 }
314+
315+ function test_closeWhileDragging() {
316+ launcher.openDrawer(true);
317+ waitForRendering(launcher);
318+ waitUntilTransitionsEnd(launcher);
319+
320+ var drawer = findChild(launcher, "drawer");
321+ tryCompare(drawer.anchors, "rightMargin", -drawer.width);
322+
323+ mousePress(drawer, drawer.width / 2, drawer.height / 2);
324+ mouseMove(drawer, drawer.width / 4, drawer.height / 2);
325+ tryCompare(drawer, "draggingHorizontally", true);
326+
327+ keyPress(Qt.Key_Escape);
328+
329+ tryCompare(launcher, "state", "");
330+ tryCompare(drawer, "draggingHorizontally", false);
331+ }
314 }
332 }
315}
333}