diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-09-07 07:49:00 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-08 23:21:54 +0100 |
commit | 463aff827e4d47afacd6693a031e8e0d868affc8 (patch) | |
tree | 0361ffa3d77218561571f4794360d2037ec2f056 /Userland/Libraries/LibGUI/Window.cpp | |
parent | 6c35aac617b60f76a2daf5dcb2ad558a162c175a (diff) | |
download | serenity-463aff827e4d47afacd6693a031e8e0d868affc8.zip |
LibGUI+WindowServer: Notify Windows on input preemption
Previously Menus set themselves as active input solely to make
sure CaptureInput modals would close, but this is a functional
half-truth. Menus don't actually use the active input role; they
preempt normal Windows during event handling instead.
Now the active input window is notified on preemption and Menus
can remain outside the active input concept. This lets us make
more granular choices about modal behavior. For now, the only
thing clients care about is menu preemption on popup.
Fixes windows which close on changes to active input closing
on their own context menus.
Diffstat (limited to 'Userland/Libraries/LibGUI/Window.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Window.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index e6459d73b6..9969016530 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -1110,6 +1110,12 @@ void Window::notify_state_changed(Badge<ConnectionToWindowServer>, bool minimize } } +void Window::notify_input_preempted(Badge<ConnectionToWindowServer>, InputPreemptor preemptor) +{ + if (on_input_preemption) + on_input_preemption(preemptor); +} + Action* Window::action_for_shortcut(Shortcut const& shortcut) { Action* found_action = nullptr; |