Kaynağa Gözat

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.
Andreas Kling 3 yıl önce
ebeveyn
işleme
7a1a8d267d

+ 2 - 2
Userland/Services/WindowServer/MenuManager.cpp

@@ -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