From a47b6f94352e746f65d4a9bd90f0d25139ecf025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 9 Feb 2016 08:45:29 +0100 Subject: [PATCH] Unset focused keyboard surface when screen is locked If the screen is locked and no lock screen is shown yet we unset the focused keyboard surface on key event. Similar we restore when screen is unlocked. This should hopefully fix the broken lockscreen unit test which hits the special condition as the greeter doesn't show up on build.kde.org. --- input.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/input.cpp b/input.cpp index f247d9bdb2..cbbe588e7b 100644 --- a/input.cpp +++ b/input.cpp @@ -983,6 +983,11 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa } return; } while (it != stacking.begin()); + if (auto seat = findSeat()) { + seat->setFocusedKeyboardSurface(nullptr); + seat->setTimestamp(time); + state == InputRedirection::KeyboardKeyPressed ? seat->keyPressed(key) : seat->keyReleased(key); + } return; } @@ -1035,6 +1040,10 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa } } if (auto seat = findSeat()) { + if (workspace()->activeClient() && + (seat->focusedKeyboardSurface() != workspace()->activeClient()->surface())) { + seat->setFocusedKeyboardSurface(workspace()->activeClient()->surface()); + } seat->setTimestamp(time); state == InputRedirection::KeyboardKeyPressed ? seat->keyPressed(key) : seat->keyReleased(key); }