1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

WindowServer: Reset menu position when opened by the menu bar

Also, only mark the menu bar item as opened if a menu was actually
opened through the menu bar.

These changes allow a menu to be used both in the menu bar as well
as a context menu.

Fixes #5469
This commit is contained in:
Tom 2021-02-21 19:49:08 -07:00 committed by Andreas Kling
parent bd318dcdcd
commit 35363a972a
4 changed files with 19 additions and 21 deletions

View file

@ -323,7 +323,7 @@ void Menu::descend_into_submenu_at_hovered_item()
ASSERT(hovered_item());
auto submenu = hovered_item()->submenu();
ASSERT(submenu);
MenuManager::the().open_menu(*submenu, false);
MenuManager::the().open_menu(*submenu, false, false);
submenu->set_hovered_item(0);
ASSERT(submenu->hovered_item()->type() != MenuItem::Separator);
}
@ -554,7 +554,7 @@ void Menu::do_popup(const Gfx::IntPoint& position, bool make_input)
window.move_to(adjusted_pos);
window.set_visible(true);
MenuManager::the().open_menu(*this, make_input);
MenuManager::the().open_menu(*this, false, make_input);
WindowManager::the().did_popup_a_menu({});
}