Skip to content

input/pointer: Support wl_pointer.warp in MotionEvent - #2137

Draft
ids1024 wants to merge 3 commits into
Smithay:masterfrom
ids1024:warp
Draft

input/pointer: Support wl_pointer.warp in MotionEvent#2137
ids1024 wants to merge 3 commits into
Smithay:masterfrom
ids1024:warp

Conversation

@ids1024

@ids1024 ids1024 commented Aug 12, 2026

Copy link
Copy Markdown
Member

Description

Based on #2108.

cosmic-comp needs to be updated with this to test properly with pointer constraints, then it needs testing in XWayland/etc. This is meant to replace the motion/relative_motion code in pop-os/cosmic-comp@dda2d14832.

As far as I understand, it should be correct to use .motion on older versions of the protocol, and .warp on newer versions. If the .relative_pointer event with a delta of 0 is just a workaround for the lack of a "warp" in earlier versions of the protocol, it presumably isn't necessary to send with newer versions? In which case, handling here seems appropriate.

Checklist

Being more strongly typed here seems good in general.

More specifically, this should help for implementing
`input-timestamps-unstable-v1`, or synthesizing events with microsecond
timestamps from an event using millisecond timestamps.

This change itself has no impact on what timestamps are actually sent
anywhere.
In practice, we likely can and must assume `CLOCK_MONOTONIC` is used for
input timestamps. And already do. Provide a helper for this.

In some places this is equivalent to the code that was previously used.
In others a timestamp of `0` was used, which appears to be invalid.
@codecov-commenter

codecov-commenter commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.92135% with 155 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.39%. Comparing base (20061c1) to head (82808ef).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
src/wayland/seat/pointer.rs 5.55% 34 Missing ⚠️
src/wayland/relative_pointer.rs 3.03% 32 Missing ⚠️
src/wayland/pointer_gestures.rs 27.27% 16 Missing ⚠️
src/input/pointer/mod.rs 6.66% 14 Missing ⚠️
src/backend/input/mod.rs 40.00% 9 Missing ⚠️
src/input/tablet/tool/mod.rs 0.00% 9 Missing ⚠️
src/input/keyboard/mod.rs 0.00% 8 Missing ⚠️
anvil/src/input_handler.rs 0.00% 6 Missing ⚠️
src/wayland/seat/keyboard.rs 0.00% 6 Missing ⚠️
anvil/src/focus.rs 25.00% 3 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2137      +/-   ##
==========================================
- Coverage   17.41%   17.39%   -0.02%     
==========================================
  Files         187      187              
  Lines       30976    31172     +196     
==========================================
+ Hits         5393     5422      +29     
- Misses      25583    25750     +167     
Flag Coverage Δ
wlcs-buffer 15.08% <0.56%> (-0.08%) ⬇️
wlcs-core 14.66% <0.56%> (-0.08%) ⬇️
wlcs-output 6.53% <0.56%> (-0.03%) ⬇️
wlcs-pointer-input 16.37% <12.92%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@YaLTeR

YaLTeR commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Hm. What about cases like the new logic in ClickGrab that updates the focus start data? I guess it doesn't need any explicit handling because if the compositor changes the location of the surface without a pointer event, it will send is_warp: true, which will pass through ClickGrab correctly, and if it's coincided with an input event, then the compositor will send is_warp: false, which will also be correct?

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.

3 participants