mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Merge pull request #148 from vberger/master
wayland: implement modifiers
This commit is contained in:
commit
d0ae5bda16
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue