Skip to content

WIP Add an InputTime type to use instead of u32/u64 - #2108

Draft
ids1024 wants to merge 1 commit into
Smithay:masterfrom
ids1024:InputTime
Draft

WIP Add an InputTime type to use instead of u32/u64#2108
ids1024 wants to merge 1 commit into
Smithay:masterfrom
ids1024:InputTime

Conversation

@ids1024

@ids1024 ids1024 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description

I've been wondering if it would be good if time was a newtype instead of just an integer for a while.

Making the event structs in src/input using microsecond precision instead of just millisecond would presumably be a prerequisite for https://wayland.app/protocols/input-timestamps-unstable-v1.

But I ran into that trying to add wl_keyboard.warp, as an is_warp: bool field of MotionEvent. (I'm still not entirely sure on doing that vs having a separate WarpEvent; if all the logic for handling it is the same as motion events, it may make sense and save a lot of duplication). But with a fallback to send motion and a 0 relative_motion on clients not binding the latest version. relative_motion requires a microsecond time.

Going through this also reminds me that in some cases smithay synthesizes input events with a time of 0, which is probably not correct. In at least one place it synthesizes an event using CLOCK_MONOTONIC. That does match libinput (https://wayland.freedesktop.org/libinput/doc/latest/timestamps.html) but technically isn't guranteed if we had a Wayland backend. I think X also was typically CLOCK_MONOTONIC but not technically guaranteed?

I still need to update anvil/etc.

Checklist

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