diff options
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/Drawer.qml | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/desktop/Drawer.qml b/desktop/Drawer.qml index 4285506..92c4fca 100644 --- a/desktop/Drawer.qml +++ b/desktop/Drawer.qml @@ -68,6 +68,14 @@ Scope { root.open = true; } + // One step out: history, then a page, then the drawer itself. Escape + // and the mouse's back button. + function back() { + if (root.history) root.history = false; + else if (root.page) root.page = ""; + else root.close(); + } + function close() { root.open = false; // Reset to the grid: a panel that reopens somewhere unexpected is @@ -114,6 +122,17 @@ Scope { onClicked: root.close() } + // The mouse's back button, anywhere on the surface. On top of + // everything and taking only that button, so left clicks pass + // through it: a back press left to fall through from below never + // arrived, because something on the page took it first. + MouseArea { + anchors.fill: parent + z: 1 + acceptedButtons: Qt.BackButton + onClicked: root.back() + } + // Keys reach a focused item, never the window: setting // keyboardFocus above is necessary but not sufficient, and // Keys.onEscapePressed on a PanelWindow never fires. See AGENTS.md. @@ -131,11 +150,7 @@ Scope { // content, a key pressed in any focused descendant bubbles up // to it. focus: true - Keys.onEscapePressed: { - if (root.history) root.history = false; - else if (root.page) root.page = ""; - else root.close(); - } + Keys.onEscapePressed: root.back() // Clicks on the panel must not reach the catcher behind it. MouseArea { anchors.fill: parent } |
