Add an input device function to convert keycodes to evdev codes
This adds a virtual function to ClutterInputDevice to translate a keycode from the hardware_keycode member of ClutterKeyEvent to an evdev keycode. The function can fail so that input backends that don't have a sensible way to translate to evdev keycodes can return FALSE. There are implementations for evdev, wayland and X. The X implementation assumes that the X server is using an evdev driver in which case the hardware keycodes are the evdev codes plus 8. Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
@ -123,6 +123,17 @@ clutter_input_device_evdev_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (clutter_input_device_evdev_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
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;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass)
|
||||
{
|
||||
@ -134,6 +145,7 @@ clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass)
|
||||
object_class->get_property = clutter_input_device_evdev_get_property;
|
||||
object_class->set_property = clutter_input_device_evdev_set_property;
|
||||
object_class->finalize = clutter_input_device_evdev_finalize;
|
||||
klass->keycode_to_evdev = clutter_input_device_evdev_keycode_to_evdev;
|
||||
|
||||
/*
|
||||
* ClutterInputDeviceEvdev:udev-device:
|
||||
|
Reference in New Issue
Block a user