Skip to content

sway/input/cursor: implement pointer-warp-v1#9147

Open
llyyr wants to merge 1 commit into
swaywm:masterfrom
llyyr:add-pointer-warp
Open

sway/input/cursor: implement pointer-warp-v1#9147
llyyr wants to merge 1 commit into
swaywm:masterfrom
llyyr:add-pointer-warp

Conversation

@llyyr

@llyyr llyyr commented May 13, 2026

Copy link
Copy Markdown
Contributor

@llyyr llyyr force-pushed the add-pointer-warp branch from 37c1ff8 to adab7ed Compare May 17, 2026 14:56
Comment thread sway/server.c Outdated
@llyyr llyyr force-pushed the add-pointer-warp branch from adab7ed to 5433f1f Compare June 30, 2026 15:00
Comment thread sway/input/cursor.c Outdated
Comment thread sway/input/cursor.c Outdated
double lx = event->x + con->pending.content_x - view->geometry.x;
double ly = event->y + con->pending.content_y - view->geometry.y;
wlr_cursor_warp(cursor->cursor, NULL, lx, ly);
wlr_seat_pointer_warp(event->seat_client->seat, event->x, event->y);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to send a pointer frame event here? Or is this unnecessary, or handled elsewhere?

@llyyr llyyr Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mindlessly copying the zwp_locked_pointer_v1 implementation for pointer warp. I think that implementation does wlr_seat_pointer_warp to not send a motion event to client, since it's inhibited by the spec. The spec for pointer-warp doesn't say the motion event should inhibited though, so I don't think we should do wlr_seat_pointer_warp

Comment thread sway/input/cursor.c
return;
}

struct sway_view *view = view_from_wlr_surface(event->surface);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work for surfaces which aren't views (e.g. layer-shell, ext-session-lock). For xdg_popup, this doesn't account for the offset correctly.

Ideally we'd walk up the surface tree and accumulate delta coordinates. This could be left as a TODO for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same applies for pointer-constraints too

Comment thread sway/input/cursor.c
Comment thread sway/input/cursor.c
Comment on lines +1453 to +1454
double lx = event->x + con->pending.content_x - view->geometry.x;
double ly = event->y + con->pending.content_y - view->geometry.y;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use pending or current here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pending state is right here, as with zwp_locked_pointer_v1

@llyyr llyyr force-pushed the add-pointer-warp branch from 5433f1f to 1c31a40 Compare June 30, 2026 21:46
@llyyr llyyr force-pushed the add-pointer-warp branch from 1c31a40 to d614d01 Compare June 30, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants