Skip to content

2066 touch input rework#2067

Open
Ph4ntomas wants to merge 7 commits into
Smithay:masterfrom
Ph4ntomas:2066-touch-input-rework
Open

2066 touch input rework#2067
Ph4ntomas wants to merge 7 commits into
Smithay:masterfrom
Ph4ntomas:2066-touch-input-rework

Conversation

@Ph4ntomas

@Ph4ntomas Ph4ntomas commented Jun 13, 2026

Copy link
Copy Markdown

Description

This series rework the touch handling API with the following changes:

  • frame serial are now internal to TouchInternal. They are only sent
    to the TouchTarget as part of a frame() or cancel() call.
    EDIT: Instead of a Serial, a new FrameMarker is used.
    • The frame serial are generated once per frame, and discarded on a call
      to frame or cancel.
      EDIT: That's still true, but since the FrameMarker type is an id, it's not as simple. TouchInternal::frame no longer discard the marker, as it may not be called. The id for the pending frame is now removed by TouchHandle on a call to frame or cancel instead.
  • TouchInternal is now responsible for de-duplicating frame and cancel
    events. It does so by retrieving the last_serial from the
    TouchTarget before sending the event.
    It's possible for a target to opt-out of this behavior by always returning None in last_serial
    EDIT: last serial was changed to last_frame

Closes #2066

Checklist

Comment thread src/wayland/seat/touch.rs Outdated
This commit rework the touch handling API with the following changes:
- frame serial are now internal to `TouchInternal`. They are only sent
  to the `TouchTarget` as part of a frame() or cancel() call.
- The frame serial are generated once per frame, and discarded on a call
  to frame or cancel.
- `TouchInternal` is now responsible for de-duplicating frame and cancel
  events. It does so by retrieving the last_serial from the
  `TouchTarget` before sending the event.
@Ph4ntomas Ph4ntomas force-pushed the 2066-touch-input-rework branch from 0ae6151 to 81d0839 Compare June 13, 2026 19:17
Serial gives the wrong impression as to what the type is meant for. The
new FrameMarker is explicitely meant as a disambiguation marker to avoid
sending frame and cancel events more than once.
This bring TouchHandle code in line with PointerHandle, and will allow
compositor to e.g. find whether a client bound wl_touch interface, to
know whether to trigger pointer emulation.
@Ph4ntomas Ph4ntomas marked this pull request as ready for review June 13, 2026 20:49
@Ph4ntomas Ph4ntomas force-pushed the 2066-touch-input-rework branch from 81d0839 to 1eabad6 Compare June 13, 2026 21:08
Comment thread src/input/touch/mod.rs
focus: HashMap<TouchSlot, TouchSlotState<D>>,
seq_counter: SerialCounter,
pending_frame: Option<Serial>,
pending_frame: Option<FrameMarker>,

@Ph4ntomas Ph4ntomas Jun 14, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

A drop implementation is missing here. We won't remove the pending frame if the TouchHandle is dropped.

I'll look into that.

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.

RFC: Rework input::touch module

1 participant