on xenial help sign in
fix cancelling kbd navigation if the launcher is locked out
3cf7a86Michael Zanetti
qml/Launcher/Launcher.qml+4−2
@@ -30,7 +30,7 @@ FocusScope {
30 property alias inverted: panel.inverted
30 property alias inverted: panel.inverted
31 property bool shadeBackground: true // can be used to disable background shade when launcher is visible
31 property bool shadeBackground: true // can be used to disable background shade when launcher is visible
32
32
33− property int panelWidth: units.gu(8)
33+ property int panelWidth: units.gu(10)
34 property int dragAreaWidth: units.gu(1)
34 property int dragAreaWidth: units.gu(1)
35 property int minimizeDistance: units.gu(26)
35 property int minimizeDistance: units.gu(26)
36 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
36 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
@@ -312,9 +312,10 @@ FocusScope {
312 InverseMouseArea {
312 InverseMouseArea {
313 id: closeMouseArea
313 id: closeMouseArea
314 anchors.fill: panel
314 anchors.fill: panel
315− enabled: root.shadeBackground && root.state == "visible" && !root.lockedVisible
315+ enabled: root.shadeBackground && root.state == "visible" && (!root.lockedVisible || panel.highlightIndex >= -1)
316 visible: enabled
316 visible: enabled
317 onPressed: {
317 onPressed: {
318+ panel.highlightIndex = -2
318 root.hide();
319 root.hide();
319 }
320 }
320 }
321 }
@@ -381,6 +382,7 @@ FocusScope {
381 }
382 }
382
383
383 onKbdNavigationCancelled: {
384 onKbdNavigationCancelled: {
385+ panel.highlightIndex = -2;
384 root.hide();
386 root.hide();
385 root.focus = false;
387 root.focus = false;
386 }
388 }
qml/Launcher/LauncherPanel.qml+7−3
@@ -664,7 +664,6 @@ Rectangle {
664 onClicked: {
664 onClicked: {
665 quickList.state = "";
665 quickList.state = "";
666 quickList.focus = false;
666 quickList.focus = false;
667− root.highlightIndex = -2;
668 root.kbdNavigationCancelled();
667 root.kbdNavigationCancelled();
669 }
668 }
670
669
@@ -735,16 +734,21 @@ Rectangle {
735 case Qt.Key_Left:
734 case Qt.Key_Left:
736 case Qt.Key_Escape:
735 case Qt.Key_Escape:
737 quickList.selectedIndex = -1;
736 quickList.selectedIndex = -1;
738− // Falling through intentionally
737+ quickList.focus = false;
738+ quickList.state = ""
739+ event.accepted = true;
740+ break;
739 case Qt.Key_Enter:
741 case Qt.Key_Enter:
740 case Qt.Key_Return:
742 case Qt.Key_Return:
741 case Qt.Key_Space:
743 case Qt.Key_Space:
742 if (quickList.selectedIndex >= 0) {
744 if (quickList.selectedIndex >= 0) {
743 LauncherModel.quickListActionInvoked(quickList.appId, quickList.selectedIndex)
745 LauncherModel.quickListActionInvoked(quickList.appId, quickList.selectedIndex)
744 }
746 }
747+ quickList.selectedIndex = -1;
745 quickList.focus = false;
748 quickList.focus = false;
746 quickList.state = ""
749 quickList.state = ""
747− // Don't consume the event. We want to close the Launcher too, not just the quicklist.
750+ root.kbdNavigationCancelled();
751+ event.accepted = true;
748 break;
752 break;
749 }
753 }
750 }
754 }
tests/qmltests/Launcher/tst_Launcher.qml+18−8
@@ -303,10 +303,10 @@ Item {
303 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
303 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
304
304
305 waitForRendering(launcher);
305 waitForRendering(launcher);
306− tryCompare(bfbFocusHighlight, "visible", index === -1);
306+ compare(bfbFocusHighlight.visible, index === -1);
307 for (var i = 0; i < launcherListView.count; i++) {
307 for (var i = 0; i < launcherListView.count; i++) {
308 var focusRing = findChild(findChild(launcher, "launcherDelegate" + i), "focusRing")
308 var focusRing = findChild(findChild(launcher, "launcherDelegate" + i), "focusRing")
309− tryCompare(focusRing, "visible", index === i);
309+ compare(focusRing.visible, index === i);
310 }
310 }
311 }
311 }
312
312
@@ -411,6 +411,7 @@ Item {
411 wait(100)
411 wait(100)
412 compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
412 compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
413 }
413 }
414+
414 waitUntilLauncherDisappears();
415 waitUntilLauncherDisappears();
415 launcher.available = true;
416 launcher.available = true;
416 }
417 }
@@ -1097,12 +1098,15 @@ Item {
1097 function test_keyboardNavigation() {
1098 function test_keyboardNavigation() {
1098 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
1099 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
1099 var quickList = findChild(launcher, "quickList");
1100 var quickList = findChild(launcher, "quickList");
1101+ var launcherPanel = findChild(launcher, "launcherPanel");
1100 var launcherListView = findChild(launcher, "launcherListView");
1102 var launcherListView = findChild(launcher, "launcherListView");
1101 var last = launcherListView.count - 1;
1103 var last = launcherListView.count - 1;
1102
1104
1103 compare(bfbFocusHighlight.visible, false);
1105 compare(bfbFocusHighlight.visible, false);
1104
1106
1105 launcher.openForKeyboardNavigation();
1107 launcher.openForKeyboardNavigation();
1108+ tryCompare(launcherPanel, "x", 0);
1109+ waitForRendering(launcher);
1106
1110
1107 assertFocusOnIndex(-1);
1111 assertFocusOnIndex(-1);
1108
1112
@@ -1175,6 +1179,7 @@ Item {
1175 compare(signalSpy.count, 1, "Quicklist signal wasn't triggered")
1179 compare(signalSpy.count, 1, "Quicklist signal wasn't triggered")
1176 compare(signalSpy.signalArguments[0][0], LauncherModel.get(1).appId)
1180 compare(signalSpy.signalArguments[0][0], LauncherModel.get(1).appId)
1177 compare(signalSpy.signalArguments[0][1], 2)
1181 compare(signalSpy.signalArguments[0][1], 2)
1182+ assertFocusOnIndex(-2);
1178 }
1183 }
1179
1184
1180 function test_hideNotWorkingWhenLockedOut_data() {
1185 function test_hideNotWorkingWhenLockedOut_data() {
@@ -1203,12 +1208,15 @@ Item {
1203
1208
1204 function test_cancelKbdNavigationWitMouse_data() {
1209 function test_cancelKbdNavigationWitMouse_data() {
1205 return [
1210 return [
1206− {tag: "locked out", autohide: false },
1211+ {tag: "locked out - no quicklist", autohide: false, withQuickList: false },
1212+ {tag: "locked out - with quicklist", autohide: false, withQuickList: true },
1213+ {tag: "autohide - no quicklist", autohide: true, withQuickList: false },
1207− {tag: "autohide", autohide: true },
1214+ {tag: "autohide - with quicklist", autohide: true, withQuickList: true },
1208 ]
1215 ]
1209 }
1216 }
1210
1217
1211 function test_cancelKbdNavigationWitMouse(data) {
1218 function test_cancelKbdNavigationWitMouse(data) {
1219+ launcher.autohideEnabled = data.autohide;
1212 launcher.openForKeyboardNavigation();
1220 launcher.openForKeyboardNavigation();
1213 waitForRendering(launcher);
1221 waitForRendering(launcher);
1214
1222
@@ -1219,12 +1227,14 @@ Item {
1219
1227
1220 keyClick(Qt.Key_Down); // Down to launcher item 0
1228 keyClick(Qt.Key_Down); // Down to launcher item 0
1221 keyClick(Qt.Key_Down); // Down to launcher item 1
1229 keyClick(Qt.Key_Down); // Down to launcher item 1
1222− keyClick(Qt.Key_Right); // Into quicklist
1223
1230
1231+ if (data.withQuickList) {
1232+ keyClick(Qt.Key_Right); // Into quicklist
1233+ tryCompare(quickList, "visible", true)
1234+ }
1224 waitForRendering(launcher)
1235 waitForRendering(launcher)
1225− tryCompare(quickList, "visible", true)
1226
1236
1227− mouseClick(root, root.width / 2, units.gu(2));
1237+ mouseClick(root);
1228
1238
1229 if (data.autohide) {
1239 if (data.autohide) {
1230 tryCompare(launcher, "state", "");
1240 tryCompare(launcher, "state", "");
@@ -1232,7 +1242,7 @@ Item {
1232 tryCompare(launcher, "state", "visible");
1242 tryCompare(launcher, "state", "visible");
1233 }
1243 }
1234
1244
1235− tryCompare(launcherPanel, "highlightIndex", -2);
1245+ assertFocusOnIndex(-2);
1236 }
1246 }
1237 }
1247 }
1238}
1248}