Skip to content

wlserver: Send relative pointer motion alongside absolute in mousewarp#2134

Open
loic wants to merge 1 commit into
ValveSoftware:masterfrom
loic:fix/mouselook-floor-snap
Open

wlserver: Send relative pointer motion alongside absolute in mousewarp#2134
loic wants to merge 1 commit into
ValveSoftware:masterfrom
loic:fix/mouselook-floor-snap

Conversation

@loic
Copy link
Copy Markdown

@loic loic commented Apr 13, 2026

Summary

I encountered a bug where the camera would snap to the floor when entering mouselook (holding right-click), then everything would work fine afterwards. Further testing showed that the bug completely disappears when running with --force-grab-cursor.

I investigated why --force-grab-cursor made a difference and found that it comes down to which input path is used. With --force-grab-cursor, all mouse movement goes through wlserver_mousemotion, which sends both zwp_relative_pointer_v1.relative_motion and wl_pointer.motion to XWayland. Without it, normal cursor movement goes through wlserver_mousewarp, which only sends wl_pointer.motion and no relative motion at all.

This means XWayland's relative_pointer device never gets position updates during normal gameplay. When a game enters mouselook (LOCKED pointer constraint) and gamescope switches to sending relative-only events, the relative_pointer device has a stale position, which produces a large spurious delta on the first frame and causes the camera snap.

Fix

Add wlserver_perform_rel_pointer_motion to wlserver_mousewarp so that relative motion data is always sent alongside absolute, keeping XWayland's relative pointer device in sync. This matches the existing behavior of wlserver_mousemotion and the --force-grab-cursor code path.

wlserver_mousemotion sends both relative (zwp_relative_pointer) and
absolute (wl_pointer.motion) events to XWayland, but wlserver_mousewarp
only sent absolute. This left XWayland's relative_pointer device position
stale. When a game entered mouselook (LOCKED pointer constraint), the
first relative-only event produced a bogus delta inside XWayland, causing
the camera to snap (e.g. to the floor) in affected games.

Send wlserver_perform_rel_pointer_motion from wlserver_mousewarp to keep
both devices in sync, matching the behavior of wlserver_mousemotion and
the --force-grab-cursor code path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant