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.
This commit is contained in:
Andreas Kling 2019-08-12 18:36:33 +02:00
parent b24b111298
commit af6483cabb
Notes: sideshowbarker 2024-07-19 12:42:37 +09:00

View file

@ -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();