1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibGUI+WindowServer: Introduce new mouse tracking mechanism

This commit is contained in:
Ben Wiederhake 2021-09-07 21:04:35 +02:00 committed by Andreas Kling
parent bde3c7301e
commit 45126655cd
10 changed files with 94 additions and 3 deletions

View file

@ -1200,15 +1200,18 @@ void WindowManager::process_mouse_event(MouseEvent& event)
if (process_ongoing_drag(event))
return;
// 2. Send the mouse event to all windows with global cursor tracking enabled.
// The active input tracking window is excluded here because we're sending the event to it
// in the next step.
// 2. Send the mouse event to all clients with global cursor tracking enabled.
auto& window_stack = current_window_stack();
for_each_visible_window_from_front_to_back([&](Window& window) {
if (window.global_cursor_tracking() && &window != window_stack.active_input_tracking_window())
deliver_mouse_event(window, event, false);
return IterationDecision::Continue;
});
ClientConnection::for_each_client([&](ClientConnection& conn) {
if (conn.does_global_mouse_tracking()) {
conn.async_track_mouse_move(event.position());
}
});
// 3. If there's an active input tracking window, all mouse events go there.
// Tracking ends after all mouse buttons have been released.