diff --git a/repos/os/src/server/nitpicker/mode.h b/repos/os/src/server/nitpicker/mode.h index 3bb6bb7357..02b9be8d85 100644 --- a/repos/os/src/server/nitpicker/mode.h +++ b/repos/os/src/server/nitpicker/mode.h @@ -30,6 +30,13 @@ class Mode Session *_next_focused_session = nullptr; + protected: + + /* + * True while a global key sequence is processed + */ + bool _global_key_sequence = false; + public: virtual ~Mode() { } @@ -64,7 +71,13 @@ class Mode */ void apply_pending_focus_change() { - if (key_is_pressed()) + /* + * Defer focus changes to a point where no drag operation is in + * flight because otherwise, the involved sessions would obtain + * inconsistent press and release events. However, focus changes + * during global key sequences are fine. + */ + if (key_is_pressed() && !_global_key_sequence) return; if (_focused_session != _next_focused_session) diff --git a/repos/os/src/server/nitpicker/user_state.h b/repos/os/src/server/nitpicker/user_state.h index 2316e43d1a..f8cc4303ca 100644 --- a/repos/os/src/server/nitpicker/user_state.h +++ b/repos/os/src/server/nitpicker/user_state.h @@ -46,11 +46,6 @@ class User_state : public Mode, public View_stack */ Session *_input_receiver = nullptr; - /* - * True while a global key sequence is processed - */ - bool _global_key_sequence = false; - void _update_all(); public: