on xenial help sign in
Fix hiding drawer using Super key

Previously, pressing "Super" key while the drawer is shown would hide only the drawer, not the launcher. This commit makes `toggleDrawer()` accept another argument, "alsoToggle Launcher". This will hide the launcher together with the drawer, except if `Launcher.lockedVisible` is active at the moment. Shell is updated to make use of this argument. Fixes https://github.com/ubports/ubuntu-touch/issues/1425

commit7013f90cfb8fed2d2a408005a8fcc2366e41a7a6 authorRatchanan Srirattanamet <ratchanan@ubports.com> dateFri 17 Apr 2020, 18:48 (7 years ago) parent105fb57
2 files changed+10−6
qml/Launcher/Launcher.qml+7−5 qml/Shell.qml+3−1
qml/Launcher/Launcher.qml+7−5
@@ -183,7 +183,7 @@ FocusScope {
183183 switchToNextState("visible")
184184 }
185185
186− function toggleDrawer(focusInputField, onlyOpen) {
186+ function toggleDrawer(focusInputField, onlyOpen, alsoToggleLauncher) {
187187 if (!drawerEnabled) {
188188 return;
189189 }
@@ -196,11 +196,13 @@ FocusScope {
196196 if (focusInputField) {
197197 drawer.focusInput();
198198 }
199− if (state === "drawer" && !onlyOpen) {
200− switchToNextState("visible");
201− } else {
199+ if (state === "drawer" && !onlyOpen)
200+ if (alsoToggleLauncher && !root.lockedVisible)
201+ switchToNextState("");
202+ else
203+ switchToNextState("visible");
204+ else
202205 switchToNextState("drawer");
203− }
204206 }
205207
206208 Keys.onPressed: {
qml/Shell.qml+3−1
@@ -253,7 +253,9 @@ StyledItem {
253253 onHomeKeyActivated: {
254254 // Ignore when greeter is active, to avoid pocket presses
255255 if (!greeter.active) {
256− launcher.toggleDrawer(false);
256+ launcher.toggleDrawer(/* focusInputField */ false,
257+ /* onlyOpen */ false,
258+ /* alsoToggleLauncher */ true);
257259 }
258260 }
259261 onTouchBegun: { cursor.opacity = 0; }