evdev: Only create a xkbcommon mapping for keyboard devices

This commit is contained in:
Damien Lespiau 2010-11-09 13:14:37 -05:00
parent 7cd6ba2828
commit 94c2812d72

View File

@ -196,6 +196,9 @@ clutter_event_dispatch (GSource *g_source,
if (e->value == 2)
continue;
/* if we have a mapping for that device, use it to generate
* the event */
if (source->xkb)
event =
_clutter_key_event_new_from_evdev (input_device,
stage,
@ -252,6 +255,7 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
{
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
ClutterEventSource *event_source = (ClutterEventSource *) source;
ClutterInputDeviceType type;
const gchar *node_path;
gint fd;
@ -272,6 +276,11 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
event_source->event_poll_fd.fd = fd;
event_source->event_poll_fd.events = G_IO_IN;
type =
clutter_input_device_get_device_type (CLUTTER_INPUT_DEVICE (input_device));
if (type == CLUTTER_KEYBOARD_DEVICE)
{
/* create the xkb description */
event_source->xkb = _clutter_xkb_desc_new (NULL,
option_xkb_layout,
@ -285,6 +294,7 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
g_source_unref (source);
return NULL;
}
}
/* and finally configure and attach the GSource */
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);