1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 03:35:09 +00:00

WindowServer+LibGUI: Fix global mouse tracking with recursive widget trees.

Also avoid sending multiple copies of mouse events to global trackers.
This commit is contained in:
Andreas Kling 2019-02-26 10:34:05 +01:00
parent 2fb3fa7f69
commit 1effe70543
2 changed files with 10 additions and 7 deletions

View file

@ -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<WSMouseEvent>(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<WSMouseEvent>(event.type(), position, event.buttons(), event.button());
window.on_message(*local_event);
}
return IterationDecision::Abort;
}
return IterationDecision::Continue;