WindowServer: Add menus to open menu stack before making them visible

This prevents an issue where the first mouse event in a newly opened
would not get handled because we didn't think the menu was open yet.
This commit is contained in:
Andreas Kling 2021-11-05 00:54:49 +01:00
parent 239520ae54
commit 7a1a8d267d

View file

@ -296,6 +296,8 @@ void MenuManager::open_menu(Menu& menu, bool as_current_menu)
return;
}
m_open_menu_stack.append(menu);
if (!menu.is_empty()) {
menu.redraw_if_theme_changed();
auto* window = menu.menu_window();
@ -303,8 +305,6 @@ void MenuManager::open_menu(Menu& menu, bool as_current_menu)
window->set_visible(true);
}
m_open_menu_stack.append(menu);
if (as_current_menu || !current_menu()) {
// Only make this menu the current menu if requested, or if no
// other menu is current