diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp index 02826f2c2e..0b61f922cf 100644 --- a/LibGUI/GWindow.cpp +++ b/LibGUI/GWindow.cpp @@ -140,9 +140,9 @@ void GWindow::event(GEvent& event) { if (event.is_mouse_event()) { if (m_global_cursor_tracking_widget) { - // FIXME: This won't work for widgets-within-widgets. auto& mouse_event = static_cast(event); - Point local_point { mouse_event.x() - m_global_cursor_tracking_widget->relative_rect().x(), mouse_event.y() - m_global_cursor_tracking_widget->relative_rect().y() }; + auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect(); + Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() }; auto local_event = make(event.type(), local_point, mouse_event.buttons(), mouse_event.button()); m_global_cursor_tracking_widget->event(*local_event); } @@ -154,7 +154,8 @@ void GWindow::event(GEvent& event) auto local_event = make(event.type(), Point { result.localX, result.localY }, mouse_event.buttons(), mouse_event.button()); ASSERT(result.widget); set_hovered_widget(result.widget); - return result.widget->event(*local_event); + if (result.widget != m_global_cursor_tracking_widget.ptr()) + return result.widget->event(*local_event); } return; } diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp index cb1d88f0ec..5f61edd2b5 100644 --- a/WindowServer/WSWindowManager.cpp +++ b/WindowServer/WSWindowManager.cpp @@ -740,10 +740,12 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event, WSWindow*& event_ return IterationDecision::Abort; } event_window = &window; - // FIXME: Should we just alter the coordinates of the existing MouseEvent and pass it through? - Point position { event.x() - window.rect().x(), event.y() - window.rect().y() }; - auto local_event = make(event.type(), position, event.buttons(), event.button()); - window.on_message(*local_event); + if (!window.global_cursor_tracking()) { + // FIXME: Should we just alter the coordinates of the existing MouseEvent and pass it through? + Point position { event.x() - window.rect().x(), event.y() - window.rect().y() }; + auto local_event = make(event.type(), position, event.buttons(), event.button()); + window.on_message(*local_event); + } return IterationDecision::Abort; } return IterationDecision::Continue;