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
This commit is contained in:
Giovanni Campagna 2013-08-09 10:10:36 +02:00
parent 26b2852601
commit a3557f7a2f

View File

@ -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;
}