Skip to content

wl_seat v10 with compositor key repeat #1773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dcz-self
Copy link
Contributor

@dcz-self dcz-self commented Jul 9, 2025

This adds compositor-side key repeat from the just released wl_keyboard v10.

There are some problems:

  1. Repeat events have the same serial
  2. Filtering may be broken
  3. Arming the repeat timeout is ugly

With the above in mind, I'm not sure if I plugged it in the correct place, so I'm marking this as a draft.

@dcz-self
Copy link
Contributor Author

dcz-self commented Jul 10, 2025

I fixed the serial generation by pushing the logic up a bit, close to where the backend receives the event.

The events go now like:

  1. comp: Backend
  2. smithay: Repeat registration -> transforms backend event into generic event, adds Repeated
  3. comp (via callback): event handler
  4. comp: filtering -> adds Serial
  5. comp: forwarding
  6. smithay: normal client handling

This means the repeating is global to the seat: switch from one client to the other and repeating continues. If repeating was per-client, then the compositor itself would not receive repeat events without making it look like a client (and I'm not ready for that level of rearchitecting). The good news is I think feels more natural :) The bad news is corner cases when switching because a Repeated event may not appear without a Pressed event according to wl_keyboard:

The key may only enter the repeated state after entering the pressed
state and before entering the released state.

I haven't tried to add those corner cases yet.

EDIT: I read the spec more carefully and this is not needed.

Does this design look right?

This implements KeyState::Repeat from wayland-protocols seat version 10.
@dcz-self dcz-self force-pushed the repeat branch 10 times, most recently from 8f73732 to 22bd9b0 Compare July 22, 2025 18:47
@dcz-self dcz-self changed the title Draft: wl_seat v10 with compositor key repeat wl_seat v10 with compositor key repeat Jul 22, 2025
@dcz-self
Copy link
Contributor Author

This still relies on unreleased wayland-rs, but I copleted and undrafted it to reflect my confidence.

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.

2 participants