diff --git a/src/core/button.rs b/src/core/button.rs index c535535..4a050f8 100644 --- a/src/core/button.rs +++ b/src/core/button.rs @@ -184,6 +184,18 @@ impl Button { &self.layout } + #[inline(always)] + pub fn keyboard(&self) -> &K + { + &self.kbd + } + + #[inline(always)] + pub fn keyboard_mut(&mut self) -> &mut K + { + &mut self.kbd + } + #[inline(always)] pub fn mod_state(&self) -> &[ModState; MODIFIERS_MAX] { diff --git a/src/wayland/dispatcher.rs b/src/wayland/dispatcher.rs index 6d1cbb5..f2916d2 100644 --- a/src/wayland/dispatcher.rs +++ b/src/wayland/dispatcher.rs @@ -450,7 +450,9 @@ impl Dispatch for Dispatcher { zwp_input_method_v2::Event::TextChangeCause { .. } => (), zwp_input_method_v2::Event::ContentType { .. } => (), zwp_input_method_v2::Event::SurroundingText { .. } => (), - zwp_input_method_v2::Event::Done => (), + zwp_input_method_v2::Event::Done => { + ctx.seat.keyboard_mut().done(); + }, _ => eprintln!("warn: unknown zwp_input_method_v2 event emitted"), } } diff --git a/src/wayland/keyboard.rs b/src/wayland/keyboard.rs index 2d9c210..adfa752 100644 --- a/src/wayland/keyboard.rs +++ b/src/wayland/keyboard.rs @@ -26,6 +26,8 @@ pub struct VirtualKeyboard { keymap: File, keymap_id: u8, + im_serial: u32, + keycodes: HashMap, pressed: [Keysym; 248], mod_state: u32, @@ -48,6 +50,8 @@ impl VirtualKeyboard { keymap, keymap_id: 1, + im_serial: 0, + keycodes: HashMap::with_capacity(248), pressed: [Keysym::NoSymbol; 248], mod_state: 0, @@ -77,6 +81,11 @@ impl VirtualKeyboard { keycode).unwrap(); } } + + pub fn done(&mut self) + { + self.im_serial += 1; + } } impl Keyboard for VirtualKeyboard { diff --git a/src/wayland/seat.rs b/src/wayland/seat.rs index 4159d83..327e2c4 100644 --- a/src/wayland/seat.rs +++ b/src/wayland/seat.rs @@ -91,6 +91,18 @@ impl &K + { + self.button.keyboard() + } + + #[inline(always)] + pub fn keyboard_mut(&mut self) -> &mut K + { + self.button.keyboard_mut() + } + #[inline(always)] pub fn mod_state(&self) -> &[ModState] {