mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
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:
@ -247,9 +247,21 @@ const struct wl_input_device_listener _clutter_input_device_wayland_listener = {
|
||||
clutter_wayland_handle_keyboard_focus,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
clutter_input_device_wayland_keycode_to_evdev (ClutterInputDevice *device,
|
||||
guint hardware_keycode,
|
||||
guint *evdev_keycode)
|
||||
{
|
||||
/* The hardware keycodes from the wayland backend are already evdev
|
||||
keycodes */
|
||||
*evdev_keycode = hardware_keycode;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_input_device_wayland_class_init (ClutterInputDeviceWaylandClass *klass)
|
||||
{
|
||||
klass->keycode_to_evdev = clutter_input_device_wayland_keycode_to_evdev;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user