Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

## Fixes

- Handle key repeatitions properly.

# 0.2.2 - 2024-03-10

## Fixes
Expand Down
24 changes: 15 additions & 9 deletions src/window/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ use sctk::{

use super::Window;

impl KeyboardHandler for Window {
fn press_key(
&mut self,
_conn: &Connection,
_qh: &QueueHandle<Self>,
_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) {
Expand Down Expand Up @@ -55,6 +48,19 @@ impl KeyboardHandler for Window {
),
}
}
}

impl KeyboardHandler for Window {
fn press_key(
&mut self,
_conn: &Connection,
_qh: &QueueHandle<Self>,
_keyboard: &WlKeyboard,
_serial: u32,
event: sctk::seat::keyboard::KeyEvent,
) {
self.handle_keypress(event)
}

fn update_modifiers(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion src/window/seat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Loading