1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-15 09:42:10 +00:00

WSMenuManager: On menu close, close the currently hovered menu item

Ensure that the current hover is not still hovered when the menu is
opened again.
This commit is contained in:
Shannon Booth 2020-01-03 14:09:12 +13:00 committed by Andreas Kling
parent 0c1bc91e88
commit 27cb91e3e0

View file

@ -315,6 +315,7 @@ void WSMenuManager::close_everyone()
for (auto& menu : m_open_menu_stack) {
if (menu && menu->menu_window())
menu->menu_window()->set_visible(false);
menu->clear_hovered_item();
}
m_open_menu_stack.clear();
m_current_menu = nullptr;
@ -341,6 +342,7 @@ void WSMenuManager::close_menus(const Vector<WSMenu*>& menus)
m_current_menu = nullptr;
if (menu->menu_window())
menu->menu_window()->set_visible(false);
menu->clear_hovered_item();
m_open_menu_stack.remove_first_matching([&](auto& entry) {
return entry == menu;
});