on xenial help sign in
Fix dismissing the launcher when clicking/tapping outside Fixes: #1530940, #1531339

Approved by: Michael Terry

commit5e34b133cc02aaa15dc59a41502934e62ec7f464 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateMon 11 Jan 2016, 17:38 (11 years ago) parent69ac1fa33c0752
3 files changed+24−11
qml/Launcher/Launcher.qml+4−9 qml/Launcher/LauncherPanel.qml+4−2 tests/qmltests/Launcher/tst_Launcher.qml+16
qml/Launcher/Launcher.qml+4−9
@@ -184,18 +184,13 @@ Item {
184184 }
185185 }
186186
187− MultiPointTouchArea {
187+ InverseMouseArea {
188188 id: closeMouseArea
189− anchors {
190− left: launcherDragArea.right
191− top: parent.top
192− right: parent.right
193− bottom: parent.bottom
194− }
189+ anchors.fill: panel
195190 enabled: root.shadeBackground && root.state == "visible"
196− visible: enabled // otherwise it will get in the way of cursor selection for some reason
191+ visible: enabled
197192 onPressed: {
198− root.state = ""
193+ root.hide();
199194 }
200195 }
201196
qml/Launcher/LauncherPanel.qml+4−2
@@ -392,7 +392,6 @@ Rectangle {
392392 }
393393
394394 onClicked: {
395− Haptics.play();
396395 var index = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
397396 var clickedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
398397
@@ -407,9 +406,11 @@ Rectangle {
407406 quickList.model = launcherListView.model.get(index).quickList;
408407 quickList.appId = launcherListView.model.get(index).appId;
409408 quickList.state = "open";
410− return
409+ return;
411410 }
412411
412+ Haptics.play();
413+
413414 // First/last item do the scrolling at more than 12 degrees
414415 if (index == 0 || index == launcherListView.count - 1) {
415416 if (clickedItem.angle > 12) {
@@ -636,6 +637,7 @@ Rectangle {
636637 rotation: 90
637638 }
638639 }
640+
639641 InverseMouseArea {
640642 anchors.fill: quickListShape
641643 enabled: quickList.state == "open" || pressed
tests/qmltests/Launcher/tst_Launcher.qml+16
@@ -625,6 +625,7 @@ Item {
625625 if(data.mouse) {
626626 mouseClick(root)
627627 } else {
628+ touchRelease(draggedItem)
628629 tap(root)
629630 }
630631
@@ -739,6 +740,21 @@ Item {
739740 mouseRelease(draggedItem);
740741 }
741742
743+ function test_launcher_dismiss() {
744+ dragLauncherIntoView();
745+ verify(launcher.state == "visible");
746+ mouseClick(root);
747+ waitUntilLauncherDisappears();
748+ verify(launcher.state == "");
749+
750+ // and repeat, as a test for regression in lpbug#1531339
751+ dragLauncherIntoView();
752+ verify(launcher.state == "visible");
753+ mouseClick(root);
754+ waitUntilLauncherDisappears();
755+ verify(launcher.state == "");
756+ }
757+
742758 function test_quicklist_positioning_data() {
743759 return [
744760 {tag: "top", flickTo: "top", itemIndex: 0},