From c47fc492906f1c3a8c13ff3c99945d1d7e8e4d13 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Thu, 14 May 2026 13:04:30 +0200 Subject: [PATCH] wayland: restore cursor when pointer leaves client surface When a client (e.g. foot) sets its own cursor surface via wl_pointer.set_cursor, the cursor disappears once the pointer moves off the client surface because nobody resets it. Now wl_update_pointer_focus resets to left_ptr when the pointer leaves all surfaces or enters a new one (before the client gets a chance to override via request_set_cursor). --- src/backend/wayland/wl_backend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 7e85bb4..397caa5 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -4911,6 +4911,9 @@ wl_update_pointer_focus(uint32_t time_msec) wwarning("wl_backend: pointer focus entered surface %p at %.1f,%.1f", (void *)surface, sx, sy); last_focused_surface = surface; + /* Reset to default cursor; client will override via + * request_set_cursor after receiving wl_pointer.enter. */ + 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); @@ -4921,6 +4924,9 @@ wl_update_pointer_focus(uint32_t time_msec) last_focused_surface = NULL; } wlr_seat_pointer_clear_focus(wl_state.seat); + /* Restore WM cursor — the client may have set its own cursor + * surface which becomes invalid once pointer focus leaves. */ + 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.