diff --git a/Cargo.toml b/Cargo.toml index 61f8b989..7b534561 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,6 @@ dwmapi-sys = "0.1" [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))'.dependencies] wayland-client = { version = "0.7.4", features = ["dlopen"] } -wayland-kbd = "0.6.2" +wayland-kbd = "0.7.0" wayland-window = "0.4.2" x11-dl = "2.8" diff --git a/src/api/wayland/context.rs b/src/api/wayland/context.rs index de9d21bf..c767056a 100644 --- a/src/api/wayland/context.rs +++ b/src/api/wayland/context.rs @@ -629,7 +629,13 @@ impl wl_keyboard::Handler for WaylandEnv { wl_keyboard::KeyState::Released => ElementState::Released, }; let mut guard = eviter.lock().unwrap(); - // TODO implement ModifiersState + // This is fallback impl if libxkbcommon was not available + // This case should probably never happen, as most wayland + // compositors _need_ libxkbcommon anyway... + // + // In this case, we don't have the modifiers state information + // anyway, as we need libxkbcommon to interpret it (it is + // supposed to be serialized by the compositor using libxkbcommon) guard.push_back(Event::KeyboardInput( state, key as u8, diff --git a/src/api/wayland/keyboard.rs b/src/api/wayland/keyboard.rs index 8b571a1a..98b8e1bd 100644 --- a/src/api/wayland/keyboard.rs +++ b/src/api/wayland/keyboard.rs @@ -25,6 +25,7 @@ impl wayland_kbd::Handler for KbdHandler { _proxy: &wl_keyboard::WlKeyboard, _serial: u32, _time: u32, + mods: &wayland_kbd::ModifiersState, rawkey: u32, keysym: u32, state: wl_keyboard::KeyState, @@ -37,8 +38,19 @@ impl wayland_kbd::Handler for KbdHandler { }; let vkcode = key_to_vkey(rawkey, keysym); let mut guard = eviter.lock().unwrap(); - // TODO implement ModifiersState - guard.push_back(Event::KeyboardInput(state, rawkey as u8, vkcode, ModifiersState::default())); + guard.push_back( + Event::KeyboardInput( + state, + rawkey as u8, + vkcode, + ModifiersState { + shift: mods.shift, + ctrl: mods.ctrl, + alt: mods.alt, + logo: mods.logo + } + ) + ); // send char event only on key press, not release if let ElementState::Released = state { return } if let Some(txt) = utf8 {