Browse Source

WindowServer: Switch current menu if hovering over another menu with button.

Andreas Kling 6 năm trước cách đây
mục cha
commit
6dd1a1f26d
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      WindowServer/WSWindowManager.cpp

+ 4 - 2
WindowServer/WSWindowManager.cpp

@@ -379,8 +379,10 @@ void WSWindowManager::notify_rect_changed(WSWindow& window, const Rect& old_rect
 
 void WSWindowManager::handle_menu_mouse_event(WSMenu& menu, WSMouseEvent& event)
 {
-    if (event.type() == WSMouseEvent::MouseDown && event.button() == MouseButton::Left) {
-        dbgprintf("[WM] MouseDown on menu '%s'\n", menu.name().characters());
+    bool should_open_menu = (event.type() == WSMouseEvent::MouseMove && event.buttons() & (unsigned)MouseButton::Left)
+            || (event.type() == WSMouseEvent::MouseDown && event.button() == MouseButton::Left);
+
+    if (should_open_menu) {
         if (m_current_menu == &menu)
             return;
         close_current_menu();