diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-13 11:50:39 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-13 11:50:39 +0200 |
commit | 85674aa498a80c9be73249fc291958d02ff5b4b6 (patch) | |
tree | 0c2946affd01aefd7789258ae6399d1d3b6d3580 /Servers | |
parent | f79f3f6b8c9fdc3d3f109c2f931c3f8f4fc09b38 (diff) | |
download | serenity-85674aa498a80c9be73249fc291958d02ff5b4b6.zip |
WindowServer: Don't deliver the same mouse event twice.
We were sometimes delivering the same mouse event twice to the active input
window. This happened because we had already delivered it via the automatic
cursor tracking mechanism.
Diffstat (limited to 'Servers')
-rw-r--r-- | Servers/WindowServer/WSWindowManager.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp index 3897e2a8ac..83cd86ca0a 100644 --- a/Servers/WindowServer/WSWindowManager.cpp +++ b/Servers/WindowServer/WSWindowManager.cpp @@ -629,7 +629,7 @@ void WSWindowManager::process_event_for_doubleclick(WSWindow& window, WSMouseEve // If the pointer moves too far, it's not a double click. if (elapsed_since_last_click < m_double_click_speed) { #if defined(DOUBLECLICK_DEBUG) - dbg() << "Transforming MouseUp to MouseDoubleClick!"; + dbg() << "Transforming MouseUp to MouseDoubleClick (" << elapsed_since_last_click << " < " << m_double_click_speed << ")!"; #endif event = WSMouseEvent(WSEvent::MouseDoubleClick, event.position(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta()); // invalidate this now we've delivered a doubleclick, otherwise @@ -710,8 +710,11 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& hovere // // This prevents e.g. dragging on one window out of the bounds starting // a drag in that other unrelated window, and other silly shennanigans. - auto translated_event = event.translated(-m_active_input_window->position()); - deliver_mouse_event(*m_active_input_window, translated_event); + if (!windows_who_received_mouse_event_due_to_cursor_tracking.contains(m_active_input_window)) { + auto translated_event = event.translated(-m_active_input_window->position()); + deliver_mouse_event(*m_active_input_window, translated_event); + windows_who_received_mouse_event_due_to_cursor_tracking.set(m_active_input_window.ptr()); + } if (event.type() == WSEvent::MouseUp && event.buttons() == 0) { m_active_input_window = nullptr; } |