From 04821b1abcf95a8b00d192a36f803d45822859dc Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 24 Sep 2020 11:51:25 +0200 Subject: [PATCH] nitpicker: apply focus change w/o input events This patch fixes the corner case where the keyboard focus is defined independently from user interactivity, e.g., the activation of a screensaver or lock screen. In this case, nitpicker would update its internal focus state not before the next input event is handled. Should this input event be a press event, this event would wrongly be delivered to the prior focused session. Another problematic situation is the initial state before the very first input event occurs. Since the focus remains undefined until the first input event is handled, an initial key press event would not be delivered. This is a regression caused be the transition to the event-session interface and the removal of the nitpicker's periodic way of operation. The patch fixes the problem by applying pending focus changes not only at the input processing but also on the code path that responds to focus changes (e.g., focus-rom update). Issue #3812 --- repos/os/src/server/nitpicker/user_state.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/repos/os/src/server/nitpicker/user_state.h b/repos/os/src/server/nitpicker/user_state.h index a462cf4b69..7f5195b736 100644 --- a/repos/os/src/server/nitpicker/user_state.h +++ b/repos/os/src/server/nitpicker/user_state.h @@ -283,12 +283,9 @@ class Nitpicker::User_state */ void focus(View_owner &owner) { - /* - * The focus change is not applied immediately but deferred to the - * next call of '_apply_pending_focus_change' via the periodic - * call of 'handle_input_events'. - */ _next_focused = &owner; + + _apply_pending_focus_change(); } void reset_focus() { _next_focused = nullptr; }