forked from NotAShelf/beer
input: drive key repeat off a calloop timer
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic249e3ed4742ad5bc3c12eade720a7f26a6a6964
This commit is contained in:
parent
23ad00348d
commit
ba8f8d7144
1 changed files with 14 additions and 3 deletions
|
|
@ -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<Self>,
|
||||
_: &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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue