From d5f2f2a41396192cfe77c16d2ee99aa5b96cfeb1 Mon Sep 17 00:00:00 2001 From: Scott Leggett Date: Mon, 29 Jun 2026 15:22:53 +0800 Subject: [PATCH] input: fix cursor updates on rebase and layer surface commit Previously a cursor rebase could send pointer motion events without a trailing frame event. A client could queue events indefinitely instead of processing them. In addition, cursor rebase during layer surface mapping occurred before the layer surface received its geometry in the scene graph. This change adds a frame notification after cursor rebase, and moves cursor_rebase_all() for layer surfaces from handle_map to handle_surface_commit so it occurs after geometry is assigned. --- sway/desktop/layer_shell.c | 3 +-- sway/input/seatop_default.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 2d9b0aae0..4df94852d 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -273,6 +273,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { surface->mapped = layer_surface->surface->mapped; arrange_layers(surface->output); transaction_commit_dirty(); + cursor_rebase_all(); } } @@ -297,8 +298,6 @@ static void handle_map(struct wl_listener *listener, void *data) { } arrange_layers(surface->output); } - - cursor_rebase_all(); } static void handle_unmap(struct wl_listener *listener, void *data) { diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 1e321f331..9745aa19b 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -1114,6 +1114,7 @@ static void handle_rebase(struct sway_seat *seat, uint32_t time_msec) { if (seat_is_input_allowed(seat, surface) && !cursor->hidden) { wlr_seat_pointer_notify_enter(seat->wlr_seat, surface, sx, sy); wlr_seat_pointer_notify_motion(seat->wlr_seat, time_msec, sx, sy); + wlr_seat_pointer_notify_frame(seat->wlr_seat); } } else { cursor_update_image(cursor, e->previous_node);