From ba8f8d7144690d5a2ef56c45d5e0e4d6f7e1b1db Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 24 Jun 2026 14:35:40 +0300 Subject: [PATCH] input: drive key repeat off a calloop timer Signed-off-by: NotAShelf Change-Id: Ic249e3ed4742ad5bc3c12eade720a7f26a6a6964 --- src/wayland.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/wayland.rs b/src/wayland.rs index 7dc09b9..358a44b 100644 --- a/src/wayland.rs +++ b/src/wayland.rs @@ -431,7 +431,17 @@ impl SeatHandler for App { capability: Capability, ) { if capability == Capability::Keyboard && self.keyboard.is_none() { - match self.seat_state.get_keyboard(qh, &seat, None) { + // get_keyboard_with_repeat drives key repeat off a calloop timer and + // delivers each repeat through the callback. + let loop_handle = self.loop_handle.clone(); + let keyboard = self.seat_state.get_keyboard_with_repeat( + qh, + &seat, + None, + loop_handle, + Box::new(|app: &mut App, _kbd, event| app.send_key(&event)), + ); + match keyboard { Ok(keyboard) => self.keyboard = Some(keyboard), Err(err) => tracing::warn!("get keyboard: {err}"), } @@ -499,9 +509,10 @@ impl KeyboardHandler for App { _: &QueueHandle, _: &wl_keyboard::WlKeyboard, _: u32, - event: KeyEvent, + _: KeyEvent, ) { - self.send_key(&event); + // Repeats are delivered through the get_keyboard_with_repeat callback; + // this non-calloop hook is unused. } fn release_key(