From fd7a760ce356d4cb6483423a2a5367e4f075adf5 Mon Sep 17 00:00:00 2001 From: Ollie Date: Fri, 29 May 2026 17:12:39 +0200 Subject: [PATCH] =?UTF-8?q?wl=5Fbackend:=20restore=20cursor=20reset=20on?= =?UTF-8?q?=20enter/leave=20with=20grab=20guard=20=E2=80=94=20fixes=20stuc?= =?UTF-8?q?k=20cursor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/wayland/wl_backend.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index ba4619a..905682c 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -6432,13 +6432,15 @@ wl_update_pointer_focus(uint32_t time_msec) wl_state.pointer_x, wl_state.pointer_y, &sx, &sy, &view); } - /* Track last focused surface for cursor reset on focus leave. - * We do NOT reset to left_ptr on enter — the client sets its own - * cursor via wl_pointer.set_cursor (handle_seat_request_cursor). */ static struct wlr_surface *last_focused_surface = NULL; if (surface) { if (surface != last_focused_surface) { last_focused_surface = surface; + /* Set default cursor on new surface entry. The client will + * override via wl_pointer.set_cursor, but if we're in a grab + * (move/resize, DND) the grab system manages the cursor. */ + if (!wl_state.grab_type) + wl_set_cursor_image("left_ptr"); } wlr_seat_pointer_notify_enter(wl_state.seat, surface, sx, sy); wlr_seat_pointer_notify_motion(wl_state.seat, time_msec, sx, sy); @@ -6448,9 +6450,10 @@ wl_update_pointer_focus(uint32_t time_msec) last_focused_surface = NULL; } wlr_seat_pointer_clear_focus(wl_state.seat); - /* When pointer leaves all surfaces, leave the last cursor in - * place. The next pointer enter will let the client set its own - * cursor, or the grab system manages cursor explicitly. */ + /* Restore WM cursor when pointer leaves all surfaces. + * Don't reset during grabs — pointer_change_grab manages that. */ + if (!wl_state.grab_type) + wl_set_cursor_image("left_ptr"); } /* Phase 29 (FFP): focus-follows-pointer — when the pointer enters a new * managed view, deliver WM keyboard focus without raising.