WindowServer: Process dnd mouse events first

Fixes duplicate GUI::DragOperation instances being created.

Fixes #3151
This commit is contained in:
Tom 2020-08-19 07:14:49 -06:00 committed by Andreas Kling
parent 8e97de2df9
commit f503d3c046
Notes: sideshowbarker 2024-07-19 03:25:20 +09:00

View file

@ -874,6 +874,11 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
{
HashTable<Window*> 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;