mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Fix x11 ModifiersState
This commit is contained in:
parent
a1d2ee6ecf
commit
e1e21ded28
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "winit"
|
||||
version = "0.7.4"
|
||||
version = "0.7.5"
|
||||
authors = ["The winit contributors, Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
||||
description = "Cross-platform window creation library."
|
||||
keywords = ["windowing"]
|
||||
|
|
|
@ -266,8 +266,16 @@ impl EventsLoop {
|
|||
|
||||
let xkev: &mut ffi::XKeyEvent = xev.as_mut();
|
||||
|
||||
|
||||
let mut ev_mods = ModifiersState::default();
|
||||
let ev_mods = {
|
||||
// Translate x event state to mods
|
||||
let state = xkev.state;
|
||||
ModifiersState {
|
||||
alt: state & ffi::Mod1Mask != 0,
|
||||
shift: state & ffi::ShiftMask != 0,
|
||||
ctrl: state & ffi::ControlMask != 0,
|
||||
logo: state & ffi::Mod4Mask != 0,
|
||||
}
|
||||
};
|
||||
|
||||
let keysym = unsafe {
|
||||
(self.display.xlib.XKeycodeToKeysym)(self.display.display, xkev.keycode as ffi::KeyCode, 0)
|
||||
|
@ -311,26 +319,6 @@ impl EventsLoop {
|
|||
&mut keysym, &mut status);
|
||||
}
|
||||
|
||||
{
|
||||
// Translate x event state to mods
|
||||
let state = xkev.state;
|
||||
if (state & ffi::Mod1Mask) != 0 {
|
||||
ev_mods.alt = true;
|
||||
}
|
||||
|
||||
if (state & ffi::ShiftMask) != 0 {
|
||||
ev_mods.shift = true;
|
||||
}
|
||||
|
||||
if (state & ffi::ControlMask) != 0 {
|
||||
ev_mods.ctrl = true;
|
||||
}
|
||||
|
||||
if (state & ffi::Mod4Mask) != 0 {
|
||||
ev_mods.logo = true;
|
||||
}
|
||||
}
|
||||
|
||||
str::from_utf8(&buffer[..count as usize]).unwrap_or("").to_string()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue