From a3557f7a2fff0cd9a37b8e892c4a280a7304848c Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Fri, 9 Aug 2013 10:10:36 +0200 Subject: [PATCH] evdev: fix X11 to evdev keycode translation Hardware keycodes in Clutter events are x11 keycodes, which are the same as evdev + 8, but we need to reverse the translation when explicitly asked for an evdev keycode. https://bugzilla.gnome.org/show_bug.cgi?id=705710 --- clutter/evdev/clutter-input-device-evdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clutter/evdev/clutter-input-device-evdev.c b/clutter/evdev/clutter-input-device-evdev.c index 40b3e1ff2..fc6b079d1 100644 --- a/clutter/evdev/clutter-input-device-evdev.c +++ b/clutter/evdev/clutter-input-device-evdev.c @@ -123,9 +123,11 @@ clutter_input_device_evdev_keycode_to_evdev (ClutterInputDevice *device, guint hardware_keycode, guint *evdev_keycode) { - /* The hardware keycodes from the evdev backend are already evdev - keycodes */ - *evdev_keycode = hardware_keycode; + /* The hardware keycodes from the evdev backend are almost evdev + keycodes: we use the evdev keycode file, but xkb rules have an + offset by 8. See the comment in _clutter_key_event_new_from_evdev() + */ + *evdev_keycode = hardware_keycode - 8; return TRUE; }