lock: aggressively reclaim keyboard focus on lock surface

This commit is contained in:
Damocles 2026-04-17 14:12:40 +02:00
parent 032035b7f1
commit 9f0043cd23

View file

@ -139,14 +139,26 @@ WlSessionLockSurface {
} }
} }
// Keyboard input - focus lives on an Item since WlSessionLockSurface is a window // Keyboard input - focus lives on an Item since WlSessionLockSurface is a window.
// Aggressively reclaim focus: Component.onCompleted may fire before the surface
// is configured, and other items can steal activeFocus during layout.
Item { Item {
id: _keyInput
anchors.fill: parent anchors.fill: parent
focus: true focus: true
Keys.onPressed: event => { Keys.onPressed: event => {
if (!root._unlocking) if (!root._unlocking)
root.auth.handleKey(event); root.auth.handleKey(event);
} }
onActiveFocusChanged: {
if (!activeFocus)
forceActiveFocus();
}
}
onVisibleChanged: {
if (visible)
_keyInput.forceActiveFocus();
} }
// Unlock animation // Unlock animation