on xenial help sign in
merge new prereq
016093cMichael Zanetti
qml/Launcher/Drawer.qml+4−1
@@ -212,13 +212,16 @@ FocusScope {
212 root.dragDistance += diff;
212 root.dragDistance += diff;
213 oldX = mouseX
213 oldX = mouseX
214 }
214 }
215− onReleased: {
215+ onReleased: reset();
216+ onCanceled: reset();
217+ function reset() {
216 if (root.draggingHorizontally) {
218 if (root.draggingHorizontally) {
217 root.draggingHorizontally = false;
219 root.draggingHorizontally = false;
218 parent.interactive = true;
220 parent.interactive = true;
219 }
221 }
220 reactivateTimer.start();
222 reactivateTimer.start();
221 }
223 }
224+
222 Timer {
225 Timer {
223 id: reactivateTimer
226 id: reactivateTimer
224 interval: 0
227 interval: 0
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() {
@@ -255,13 +262,6 @@ FocusScope {
255 interval: 1
262 interval: 1
256 property string nextState: ""
263 property string nextState: ""
257 onTriggered: {
264 onTriggered: {
258− if (root.lockedVisible && nextState == "") {
259− // Due to binding updates when switching between modes
260− // it could happen that our request to show will be overwritten
261− // with a hide request. Rewrite it when we know hiding is not allowed.
262− nextState = "visible"
263− }
264−
265 // switching to an intermediate state here to make sure all the
265 // switching to an intermediate state here to make sure all the
266 // values are restored, even if we were already in the target state
266 // values are restored, even if we were already in the target state
267 root.state = "tmp"
267 root.state = "tmp"
@@ -380,8 +380,7 @@ FocusScope {
380 }
380 }
381
381
382 Keys.onEscapePressed: {
382 Keys.onEscapePressed: {
383− switchToNextState("");
383+ root.hide()
384− root.focus = false;
385 }
384 }
386
385
387 onDragDistanceChanged: {
386 onDragDistanceChanged: {
tests/qmltests/Launcher/tst_Drawer.qml+18
@@ -332,5 +332,23 @@ StyledItem {
332 keyClick(Qt.Key_Down);
332 keyClick(Qt.Key_Down);
333 tryCompare(panel, "highlightIndex", 0);
333 tryCompare(panel, "highlightIndex", 0);
334 }
334 }
335+
336+ function test_closeWhileDragging() {
337+ launcher.openDrawer(true);
338+ waitForRendering(launcher);
339+ waitUntilTransitionsEnd(launcher);
340+
341+ var drawer = findChild(launcher, "drawer");
342+ tryCompare(drawer.anchors, "rightMargin", -drawer.width);
343+
344+ mousePress(drawer, drawer.width / 2, drawer.height / 2);
345+ mouseMove(drawer, drawer.width / 4, drawer.height / 2);
346+ tryCompare(drawer, "draggingHorizontally", true);
347+
348+ keyPress(Qt.Key_Escape);
349+
350+ tryCompare(launcher, "state", "");
351+ tryCompare(drawer, "draggingHorizontally", false);
352+ }
335 }
353 }
336}
354}