Skip to content

Commit

Permalink
x11: uniformize keyboard scancodes with linux (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
vberger authored and tomaka committed Sep 25, 2017
1 parent 15fbc0d commit 9c116a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Uniformize keyboard scancode values accross Wayland and X11 (#297).

# Version 0.8.1 (2017-09-22)

- Added various methods to `os::linux::EventsLoopExt`, plus some hidden items necessary to make
Expand Down
4 changes: 2 additions & 2 deletions src/platform/linux/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ impl EventsLoop {
device_id: mkdid(3),
input: KeyboardInput {
state: state,
scancode: xkev.keycode,
scancode: xkev.keycode - 8,
virtual_keycode: vkey,
modifiers: ev_mods,
},
Expand Down Expand Up @@ -537,7 +537,7 @@ impl EventsLoop {
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) };
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),
state: match xev.evtype {
ffi::XI_RawKeyPress => Pressed,
Expand Down

0 comments on commit 9c116a1

Please sign in to comment.