wl_backend: guard cursor reset in wl_update_pointer_focus during grabs; add WCUR_WAIT

This commit is contained in:
Ollie 2026-05-29 08:38:07 +02:00
parent c5a90f4c9c
commit 9592cf295e
1 changed files with 8 additions and 3 deletions

View File

@ -810,7 +810,6 @@ wl_set_cursor_image(const char *name)
{
if (!wl_state.cursor || !wl_state.xcursor_mgr)
return;
wwarning("wl_set_cursor_image: %s (grab_type=%d)", name, wl_state.grab_type);
wlr_cursor_set_xcursor(wl_state.cursor, wl_state.xcursor_mgr, name);
}
@ -6298,6 +6297,7 @@ wl_pointer_grab(WNativeWindow grab_win, WNativeWindow confine_to,
/* Map WCUR_* cursor IDs to xcursor names (same as pointer_change_grab) */
switch (cursor_id) {
case WCUR_MOVE: wl_set_cursor_image("fleur"); break;
case WCUR_WAIT: wl_set_cursor_image("watch"); break;
case WCUR_TOPLEFTRESIZE: wl_set_cursor_image("nw-resize"); break;
case WCUR_TOPRIGHTRESIZE: wl_set_cursor_image("ne-resize"); break;
case WCUR_BOTTOMLEFTRESIZE: wl_set_cursor_image("sw-resize"); break;
@ -6430,11 +6430,14 @@ wl_update_pointer_focus(uint32_t time_msec)
wl_state.pointer_x, wl_state.pointer_y, &sx, &sy, &view);
}
/* Don't reset cursor during an active WM policy grab (move/resize) —
* pointer_change_grab manages the cursor during these operations. */
static struct wlr_surface *last_focused_surface = NULL;
if (surface) {
if (surface != last_focused_surface) {
last_focused_surface = surface;
wl_set_cursor_image("left_ptr");
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);
@ -6446,7 +6449,8 @@ wl_update_pointer_focus(uint32_t time_msec)
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");
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.
@ -6542,6 +6546,7 @@ wl_pointer_change_grab(unsigned int event_mask, int cursor_id,
const char *name;
switch (cursor_id) {
case WCUR_MOVE: name = "fleur"; break;
case WCUR_WAIT: name = "watch"; break;
case WCUR_TOPLEFTRESIZE: name = "nw-resize"; break;
case WCUR_TOPRIGHTRESIZE: name = "ne-resize"; break;
case WCUR_BOTTOMLEFTRESIZE: name = "sw-resize"; break;