From f2f3df9fb1ecc6d5d4fbda26ba5d57a8c04a3b62 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 20 Aug 2021 16:02:17 +0200 Subject: [PATCH] tinywl: simplify logic for sending pointer events --- tinywl/tinywl.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 2f2257ece..8697d2b30 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -432,21 +432,19 @@ static void process_cursor_motion(struct tinywl_server *server, uint32_t time) { server->cursor_mgr, "left_ptr", server->cursor); } if (surface) { - bool focus_changed = seat->pointer_state.focused_surface != surface; /* - * "Enter" the surface if necessary. This lets the client know that the - * cursor has entered one of its surfaces. + * Send pointer enter and motion events. * - * Note that this gives the surface "pointer focus", which is distinct + * The enter event gives the surface "pointer focus", which is distinct * from keyboard focus. You get pointer focus by moving the pointer over * a window. + * + * Note that wlroots will avoid sending duplicate enter/motion events if + * the surface has already has pointer focus or if the client is already + * aware of the coordinates passed. */ wlr_seat_pointer_notify_enter(seat, surface, sx, sy); - if (!focus_changed) { - /* The enter event contains coordinates, so we only need to notify - * on motion if the focus did not change. */ - wlr_seat_pointer_notify_motion(seat, time, sx, sy); - } + wlr_seat_pointer_notify_motion(seat, time, sx, sy); } else { /* Clear pointer focus so future button events and such are not sent to * the last client to have the cursor over it. */