Explorar o código

WindowServer: Don't close menu when clicking on item with submenu (#5239)

When clicking on a menu item with a submenu, don't close the menu.
DragonAlex98 %!s(int64=4) %!d(string=hai) anos
pai
achega
885974fc3c
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      Userland/Services/WindowServer/MenuManager.cpp

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

@@ -242,6 +242,13 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event)
             }
 
             if (mouse_event.type() == Event::MouseDown) {
+                for (auto& menu : m_open_menu_stack) {
+                    if (!menu)
+                        continue;
+                    if (!menu->menu_window()->rect().contains(mouse_event.position()))
+                        continue;
+                    return;
+                }
                 close_bar();
                 topmost_menu->set_window_menu_open(false);
             }