1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:48:13 +00:00

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.
This commit is contained in:
thankyouverycool 2022-09-07 07:49:00 -04:00 committed by Linus Groh
parent 6c35aac617
commit 463aff827e
13 changed files with 48 additions and 15 deletions

View file

@ -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;