From f503d3c0468fbbe4c8672b00e407e710bfd93b0b Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 19 Aug 2020 07:14:49 -0600 Subject: [PATCH] WindowServer: Process dnd mouse events first Fixes duplicate GUI::DragOperation instances being created. Fixes #3151 --- Services/WindowServer/WindowManager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index b907b7e586..32ab9583fe 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -874,6 +874,11 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind { HashTable windows_who_received_mouse_event_due_to_cursor_tracking; + // We need to process ongoing drag events first. Otherwise, global tracking + // and dnd collides, leading to duplicate GUI::DragOperation instances + if (process_ongoing_drag(event, hovered_window)) + return; + for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) { if (!window->global_cursor_tracking() || !window->is_visible() || window->is_minimized() || window->is_blocked_by_modal_window()) continue; @@ -884,9 +889,6 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind hovered_window = nullptr; - if (process_ongoing_drag(event, hovered_window)) - return; - if (process_ongoing_window_move(event, hovered_window)) return;