on xenial help sign in
Fix dismissing the launcher when clicking/tapping outside Fixes: #1530940, #1531339
5e34b13Lukáš Tinkl
qml/Launcher/Launcher.qml+4−9
@@ -184,18 +184,13 @@ Item {
184 }
184 }
185 }
185 }
186
186
187− MultiPointTouchArea {
187+ InverseMouseArea {
188 id: closeMouseArea
188 id: closeMouseArea
189− anchors {
189+ anchors.fill: panel
190− left: launcherDragArea.right
191− top: parent.top
192− right: parent.right
193− bottom: parent.bottom
194− }
195 enabled: root.shadeBackground && root.state == "visible"
190 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
197 onPressed: {
192 onPressed: {
198− root.state = ""
193+ root.hide();
199 }
194 }
200 }
195 }
201
196
qml/Launcher/LauncherPanel.qml+4−2
@@ -392,7 +392,6 @@ Rectangle {
392 }
392 }
393
393
394 onClicked: {
394 onClicked: {
395− Haptics.play();
396 var index = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
395 var index = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
397 var clickedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
396 var clickedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
398
397
@@ -407,9 +406,11 @@ Rectangle {
407 quickList.model = launcherListView.model.get(index).quickList;
406 quickList.model = launcherListView.model.get(index).quickList;
408 quickList.appId = launcherListView.model.get(index).appId;
407 quickList.appId = launcherListView.model.get(index).appId;
409 quickList.state = "open";
408 quickList.state = "open";
410− return
409+ return;
411 }
410 }
412
411
412+ Haptics.play();
413+
413 // First/last item do the scrolling at more than 12 degrees
414 // First/last item do the scrolling at more than 12 degrees
414 if (index == 0 || index == launcherListView.count - 1) {
415 if (index == 0 || index == launcherListView.count - 1) {
415 if (clickedItem.angle > 12) {
416 if (clickedItem.angle > 12) {
@@ -636,6 +637,7 @@ Rectangle {
636 rotation: 90
637 rotation: 90
637 }
638 }
638 }
639 }
640+
639 InverseMouseArea {
641 InverseMouseArea {
640 anchors.fill: quickListShape
642 anchors.fill: quickListShape
641 enabled: quickList.state == "open" || pressed
643 enabled: quickList.state == "open" || pressed
tests/qmltests/Launcher/tst_Launcher.qml+16
@@ -625,6 +625,7 @@ Item {
625 if(data.mouse) {
625 if(data.mouse) {
626 mouseClick(root)
626 mouseClick(root)
627 } else {
627 } else {
628+ touchRelease(draggedItem)
628 tap(root)
629 tap(root)
629 }
630 }
630
631
@@ -739,6 +740,21 @@ Item {
739 mouseRelease(draggedItem);
740 mouseRelease(draggedItem);
740 }
741 }
741
742
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+
742 function test_quicklist_positioning_data() {
758 function test_quicklist_positioning_data() {
743 return [
759 return [
744 {tag: "top", flickTo: "top", itemIndex: 0},
760 {tag: "top", flickTo: "top", itemIndex: 0},