From 326058f64bfed8d932100c49d3d87e73d275dca7 Mon Sep 17 00:00:00 2001 From: Kitsu Date: Sat, 27 Sep 2025 16:06:41 -0300 Subject: [PATCH 1/2] Support repeating key presses --- src/window/keyboard.rs | 24 +++++++++++++++--------- src/window/seat.rs | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/window/keyboard.rs b/src/window/keyboard.rs index 73bb8e6..9aa8bc4 100644 --- a/src/window/keyboard.rs +++ b/src/window/keyboard.rs @@ -8,15 +8,8 @@ use sctk::{ use super::Window; -impl KeyboardHandler for Window { - fn press_key( - &mut self, - _conn: &Connection, - _qh: &QueueHandle, - _keyboard: &WlKeyboard, - _serial: u32, - event: sctk::seat::keyboard::KeyEvent, - ) { +impl Window { + pub fn handle_keypress(&mut self, event: sctk::seat::keyboard::KeyEvent) { use sctk::seat::keyboard::Keysym; type M = Modifiers; match (event.keysym, self.key_modifiers) { @@ -55,6 +48,19 @@ impl KeyboardHandler for Window { ), } } +} + +impl KeyboardHandler for Window { + fn press_key( + &mut self, + _conn: &Connection, + _qh: &QueueHandle, + _keyboard: &WlKeyboard, + _serial: u32, + event: sctk::seat::keyboard::KeyEvent, + ) { + self.handle_keypress(event) + } fn update_modifiers( &mut self, diff --git a/src/window/seat.rs b/src/window/seat.rs index 8c8dfe8..1f1a71d 100644 --- a/src/window/seat.rs +++ b/src/window/seat.rs @@ -24,7 +24,7 @@ impl SeatHandler for Window { &seat, None, self.loop_handle.clone(), - Box::new(|_state, _wl_kbd, _event| {}), + Box::new(|state, _wl_kbd, event| state.handle_keypress(event)), ) { Ok(k) => k, Err(err) => { From b2583fa3ddc7a0d2442b51f2d94203418372856f Mon Sep 17 00:00:00 2001 From: Kitsu Date: Sat, 27 Sep 2025 16:09:08 -0300 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fb9cbc..fa48f2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ ## Fixes +- Handle key repeatitions properly. + # 0.2.2 - 2024-03-10 ## Fixes