[clutter/clutter-1.16] evdev: fix X11 to evdev keycode translation



commit a3557f7a2fff0cd9a37b8e892c4a280a7304848c
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Fri Aug 9 10:10:36 2013 +0200

    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 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/clutter/evdev/clutter-input-device-evdev.c b/clutter/evdev/clutter-input-device-evdev.c
index 40b3e1f..fc6b079 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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]