瀏覽代碼

LibGUI: Stop duplicating mouse events of cursor tracking widget

Previously we didn't always return when there was an automatic cursor
tracking widget. This meant for certain events e.g. a MouseUp over
the tracking widget, the event would be fired twice on the same widget
(once on `m_automatic_cursor_tracking_widget` then again on
`result.widget` outside the if).

Fixes #16737
MacDue 2 年之前
父節點
當前提交
c7ab6daf26
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibGUI/Window.cpp

+ 1 - 1
Userland/Libraries/LibGUI/Window.cpp

@@ -385,8 +385,8 @@ void Window::handle_mouse_event(MouseEvent& event)
         } else {
             auto is_hovered = m_automatic_cursor_tracking_widget.ptr() == result.widget.ptr();
             set_hovered_widget(is_hovered ? m_automatic_cursor_tracking_widget.ptr() : nullptr);
-            return;
         }
+        return;
     }
     set_hovered_widget(result.widget);
     if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget)