1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-18 19:42:07 +00:00

WindowServer: Send key events to menu manager is there is a current menu

If there is a current menu, we now redirect all key events from window
manager to the menu manager. This allows us to properly navigate a menu
even when there is a current menu open.

Menu key navigation is now a lot more pleasant to use :^)

The action of pressing escape to close a menu has also been moved to its
proper home in menu manager in this commit.
This commit is contained in:
Shannon Booth 2020-01-12 16:03:41 +13:00 committed by Andreas Kling
parent e6c826ffc3
commit c66a6f131e
2 changed files with 17 additions and 14 deletions

View file

@ -949,10 +949,8 @@ void WSWindowManager::event(CEvent& event)
return;
}
if (key_event.type() == WSEvent::KeyUp && key_event.key() == Key_Escape) {
auto current_menu = WSMenuManager::the().current_menu();
if (current_menu)
WSMenuManager::the().close_everyone();
if (WSMenuManager::the().current_menu()) {
WSMenuManager::the().dispatch_event(event);
return;
}
@ -1004,10 +1002,6 @@ void WSWindowManager::event(CEvent& event)
m_active_window->dispatch_event(event);
return;
}
// FIXME: We should send events to the MenuManager if a window is open
// This should take priority over sending to a window.
WSMenuManager::the().dispatch_event(event);
}
CObject::event(event);