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).
This commit is contained in:
Levi Neely 2026-05-14 13:04:30 +02:00
parent 6dfdc5a108
commit c47fc49290
1 changed files with 6 additions and 0 deletions

View File

@ -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.