From a399db006eacad22dd5d182951119fa5cb714ce2 Mon Sep 17 00:00:00 2001 From: Nova Date: Sat, 15 Oct 2022 00:56:24 -0400 Subject: [PATCH] fix(wayland): add 8 to ensure keyboard mods work --- src/wayland/seat.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wayland/seat.rs b/src/wayland/seat.rs index 9206b44..526d3f0 100644 --- a/src/wayland/seat.rs +++ b/src/wayland/seat.rs @@ -43,17 +43,17 @@ impl KeyboardInfo { } } pub fn process(&mut self, key: u32, state: u32, keyboard: &WlKeyboard) -> Result<()> { - let wl_state = match state { + let wl_key_state = match state { 0 => KeyState::Released, 1 => KeyState::Pressed, _ => anyhow::bail!("Invalid key state!"), }; - let xkb_state = match state { + let xkb_key_state = match state { 0 => xkb::KeyDirection::Up, 1 => xkb::KeyDirection::Down, _ => anyhow::bail!("Invalid key state!"), }; - let state_components = self.state.update_key(key, xkb_state); + let state_components = self.state.update_key(key + 8, xkb_key_state); if state_components != 0 { self.mods.update_with(&self.state); keyboard.modifiers( @@ -64,7 +64,7 @@ impl KeyboardInfo { 0, ); } - keyboard.key(0, 0, key, wl_state); + keyboard.key(0, 0, key, wl_key_state); Ok(()) } }