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.
This commit is contained in:
Scott Leggett 2026-06-29 15:22:53 +08:00 committed by Simon Ser
parent edcc4b0ed0
commit d5f2f2a413
2 changed files with 2 additions and 2 deletions

View file

@ -273,6 +273,7 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
surface->mapped = layer_surface->surface->mapped; surface->mapped = layer_surface->surface->mapped;
arrange_layers(surface->output); arrange_layers(surface->output);
transaction_commit_dirty(); transaction_commit_dirty();
cursor_rebase_all();
} }
} }
@ -297,8 +298,6 @@ static void handle_map(struct wl_listener *listener, void *data) {
} }
arrange_layers(surface->output); arrange_layers(surface->output);
} }
cursor_rebase_all();
} }
static void handle_unmap(struct wl_listener *listener, void *data) { static void handle_unmap(struct wl_listener *listener, void *data) {

View file

@ -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) { if (seat_is_input_allowed(seat, surface) && !cursor->hidden) {
wlr_seat_pointer_notify_enter(seat->wlr_seat, surface, sx, sy); 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_motion(seat->wlr_seat, time_msec, sx, sy);
wlr_seat_pointer_notify_frame(seat->wlr_seat);
} }
} else { } else {
cursor_update_image(cursor, e->previous_node); cursor_update_image(cursor, e->previous_node);