瀏覽代碼

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 年之前
父節點
當前提交
7a1a8d267d
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Userland/Services/WindowServer/MenuManager.cpp

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

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