From af6483cabbf16bd805bf974d7898856466ee21bb Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 12 Aug 2019 18:36:33 +0200 Subject: [PATCH] WindowServer: Fix incorrect "window left" event after button drag This fixes an issue where we'd send a "cursor has left the window" message incorrectly to the client after a button was clicked and the user moved the cursor a little without releasing the button. The issue was that we didn't update the 'hovered_window' out param in mouse event processing in the case where we had an active input window set. --- Servers/WindowServer/WSWindowManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index 178168d46f..d0bdc6d3dc 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -720,6 +720,14 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere if (event.type() == WSEvent::MouseUp && event.buttons() == 0) { m_active_input_window = nullptr; } + + for_each_visible_window_from_front_to_back([&](auto& window) { + if (window.frame().rect().contains(event.position())) { + hovered_window = &window; + return IterationDecision::Break; + } + return IterationDecision::Continue; + }); } else { for_each_visible_window_from_front_to_back([&](WSWindow& window) { auto window_frame_rect = window.frame().rect();