mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
x11: uniformize keyboard scancodes with linux (#297)
This commit is contained in:
parent
15fbc0dff4
commit
9c116a1bae
|
@ -1,5 +1,7 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Uniformize keyboard scancode values accross Wayland and X11 (#297).
|
||||||
|
|
||||||
# Version 0.8.1 (2017-09-22)
|
# Version 0.8.1 (2017-09-22)
|
||||||
|
|
||||||
- Added various methods to `os::linux::EventsLoopExt`, plus some hidden items necessary to make
|
- Added various methods to `os::linux::EventsLoopExt`, plus some hidden items necessary to make
|
||||||
|
|
|
@ -290,7 +290,7 @@ impl EventsLoop {
|
||||||
device_id: mkdid(3),
|
device_id: mkdid(3),
|
||||||
input: KeyboardInput {
|
input: KeyboardInput {
|
||||||
state: state,
|
state: state,
|
||||||
scancode: xkev.keycode,
|
scancode: xkev.keycode - 8,
|
||||||
virtual_keycode: vkey,
|
virtual_keycode: vkey,
|
||||||
modifiers: ev_mods,
|
modifiers: ev_mods,
|
||||||
},
|
},
|
||||||
|
@ -537,7 +537,7 @@ impl EventsLoop {
|
||||||
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
||||||
let xkeysym = unsafe { (self.display.xlib.XKeycodeToKeysym)(self.display.display, xev.detail as ffi::KeyCode, 0) };
|
let xkeysym = unsafe { (self.display.xlib.XKeycodeToKeysym)(self.display.display, xev.detail as ffi::KeyCode, 0) };
|
||||||
callback(Event::DeviceEvent { device_id: mkdid(xev.deviceid), event: DeviceEvent::Key(KeyboardInput {
|
callback(Event::DeviceEvent { device_id: mkdid(xev.deviceid), event: DeviceEvent::Key(KeyboardInput {
|
||||||
scancode: xev.detail as u32,
|
scancode: (xev.detail - 8) as u32,
|
||||||
virtual_keycode: events::keysym_to_element(xkeysym as libc::c_uint),
|
virtual_keycode: events::keysym_to_element(xkeysym as libc::c_uint),
|
||||||
state: match xev.evtype {
|
state: match xev.evtype {
|
||||||
ffi::XI_RawKeyPress => Pressed,
|
ffi::XI_RawKeyPress => Pressed,
|
||||||
|
|
Loading…
Reference in a new issue