From d979379a99b65add78558ef84f59296ec113ec71 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Thu, 13 Aug 2020 14:48:23 +0200 Subject: [PATCH] WindowServer: Handle global cursor tracking before ongoing drag/move/resize In the case of an ongoing window drag/move/resize action WindowManager::process_mouse_event() would return early, even before delivering mouse events to windows with global cursor tracking enabled. They would only continue to receive new mouse events once those actions were completed. Fixes #3116. --- Services/WindowServer/WindowManager.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Services/WindowServer/WindowManager.cpp b/Services/WindowServer/WindowManager.cpp index 57dda5f9e6..1cebbeb5dd 100644 --- a/Services/WindowServer/WindowManager.cpp +++ b/Services/WindowServer/WindowManager.cpp @@ -871,6 +871,16 @@ void WindowManager::deliver_mouse_event(Window& window, MouseEvent& event) void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_window) { + HashTable windows_who_received_mouse_event_due_to_cursor_tracking; + + 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; + windows_who_received_mouse_event_due_to_cursor_tracking.set(window); + auto translated_event = event.translated(-window->position()); + deliver_mouse_event(*window, translated_event); + } + hovered_window = nullptr; if (process_ongoing_drag(event, hovered_window)) @@ -889,16 +899,6 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind if (m_hovered_button && event.type() == Event::MouseMove) m_hovered_button->on_mouse_event(event.translated(-m_hovered_button->screen_rect().location())); - HashTable windows_who_received_mouse_event_due_to_cursor_tracking; - - 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; - windows_who_received_mouse_event_due_to_cursor_tracking.set(window); - auto translated_event = event.translated(-window->position()); - deliver_mouse_event(*window, translated_event); - } - // FIXME: Now that the menubar has a dedicated window, is this special-casing really necessary? if (MenuManager::the().has_open_menu() || menubar_rect().contains(event.position())) { clear_resize_candidate();