wlserver: Send relative pointer motion alongside absolute in mousewarp#2134
Open
loic wants to merge 1 commit into
Open
wlserver: Send relative pointer motion alongside absolute in mousewarp#2134loic wants to merge 1 commit into
loic wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-cursormade a difference and found that it comes down to which input path is used. With--force-grab-cursor, all mouse movement goes throughwlserver_mousemotion, which sends bothzwp_relative_pointer_v1.relative_motionandwl_pointer.motionto XWayland. Without it, normal cursor movement goes throughwlserver_mousewarp, which only sendswl_pointer.motionand 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_motiontowlserver_mousewarpso that relative motion data is always sent alongside absolute, keeping XWayland's relative pointer device in sync. This matches the existing behavior ofwlserver_mousemotionand the--force-grab-cursorcode path.