1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

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.
This commit is contained in:
Linus Groh 2020-08-13 14:48:23 +02:00 committed by Andreas Kling
parent c8f8f4e6c3
commit d979379a99

View file

@ -871,6 +871,16 @@ void WindowManager::deliver_mouse_event(Window& window, MouseEvent& event)
void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_window)
{
HashTable<Window*> 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<Window*> 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();