From d4aff36875d07bc5a2edd83fc05948062088a5c2 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 21 Aug 2022 00:45:05 +0200 Subject: [PATCH] WindowServer: Include window frames when sending drag events Previously, the cursor would use a default cursor on window frames such as the title bar and menu bar, which was not quite correct as drop events were still handled there. --- Userland/Services/WindowServer/WindowManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 93c9f654cc..eb07b9cb63 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -1016,7 +1016,7 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event) m_dnd_overlay->cursor_moved(); // We didn't let go of the drag yet, see if we should send some drag move events.. - if (auto* window = current_window_stack().window_at(event.position(), WindowStack::IncludeWindowFrame::No)) { + if (auto* window = hovered_window()) { event.set_drag(true); event.set_mime_data(*m_dnd_mime_data); deliver_mouse_event(*window, event, false); @@ -1028,7 +1028,7 @@ bool WindowManager::process_ongoing_drag(MouseEvent& event) if (!(event.type() == Event::MouseUp && event.button() == MouseButton::Primary)) return true; - if (auto* window = current_window_stack().window_at(event.position())) { + if (auto* window = hovered_window()) { m_dnd_client->async_drag_accepted(); if (window->client()) { auto translated_event = event.translated(-window->position()); @@ -1429,8 +1429,9 @@ void WindowManager::event(Core::Event& event) process_mouse_event(mouse_event); m_last_processed_buttons = mouse_event.buttons(); + auto include_window_frame = m_dnd_client ? WindowStack::IncludeWindowFrame::Yes : WindowStack::IncludeWindowFrame::No; // TODO: handle transitioning between two stacks - set_hovered_window(current_window_stack().window_at(mouse_event.position(), WindowStack::IncludeWindowFrame::No)); + set_hovered_window(current_window_stack().window_at(mouse_event.position(), include_window_frame)); return; }