1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 21:45:08 +00:00

WindowServer: Don't process menu bar events when modal is open

This prevents accesing the parent window menubar when a modal is
currently open, which was not a desired behavior.
This commit is contained in:
angel 2020-04-21 16:20:50 +02:00 committed by Andreas Kling
parent 5250f4fb90
commit b9be57a9cd

View file

@ -147,11 +147,12 @@ void MenuManager::event(Core::Event& event)
void MenuManager::handle_mouse_event(MouseEvent& mouse_event) void MenuManager::handle_mouse_event(MouseEvent& mouse_event)
{ {
auto* active_window = WindowManager::the().active_window();
bool handled_menubar_event = false; bool handled_menubar_event = false;
for_each_active_menubar_menu([&](Menu& menu) { for_each_active_menubar_menu([&](Menu& menu) {
if (menu.rect_in_menubar().contains(mouse_event.position())) { if (menu.rect_in_menubar().contains(mouse_event.position())) {
handle_menu_mouse_event(menu, mouse_event); handle_menu_mouse_event(menu, mouse_event);
handled_menubar_event = true; handled_menubar_event = !active_window || !active_window->is_modal();
return IterationDecision::Break; return IterationDecision::Break;
} }
return IterationDecision::Continue; return IterationDecision::Continue;