瀏覽代碼

WindowServer: Ensure menu visibility after pushing menu to the stack

We need to make sure the menu was pushed to the open menu stack before
calling set_visible, as this may trigger cursor re-evaluation, which
in turn expects the menu to be considered open.

Fixes #10836
Tom 3 年之前
父節點
當前提交
32d59257d6
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 0 1
      Userland/Services/WindowServer/Menu.cpp
  2. 2 0
      Userland/Services/WindowServer/MenuManager.cpp

+ 0 - 1
Userland/Services/WindowServer/Menu.cpp

@@ -638,7 +638,6 @@ void Menu::do_popup(const Gfx::IntPoint& position, bool make_input, bool as_subm
     }
     }
 
 
     window.move_to(adjusted_pos);
     window.move_to(adjusted_pos);
-    set_visible(true);
     MenuManager::the().open_menu(*this, make_input);
     MenuManager::the().open_menu(*this, make_input);
     WindowManager::the().did_popup_a_menu({});
     WindowManager::the().did_popup_a_menu({});
 }
 }

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

@@ -298,6 +298,8 @@ void MenuManager::open_menu(Menu& menu, bool as_current_menu)
 
 
     m_open_menu_stack.append(menu);
     m_open_menu_stack.append(menu);
 
 
+    menu.set_visible(true);
+
     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();