mirror of
https://github.com/brl/mutter.git
synced 2025-04-08 19:29:39 +00:00
evdev: Only create a xkbcommon mapping for keyboard devices
This commit is contained in:
parent
7cd6ba2828
commit
94c2812d72
@ -196,12 +196,15 @@ clutter_event_dispatch (GSource *g_source,
|
|||||||
if (e->value == 2)
|
if (e->value == 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
event =
|
/* if we have a mapping for that device, use it to generate
|
||||||
_clutter_key_event_new_from_evdev (input_device,
|
* the event */
|
||||||
stage,
|
if (source->xkb)
|
||||||
source->xkb,
|
event =
|
||||||
_time, e->code, e->value,
|
_clutter_key_event_new_from_evdev (input_device,
|
||||||
&source->modifier_state);
|
stage,
|
||||||
|
source->xkb,
|
||||||
|
_time, e->code, e->value,
|
||||||
|
&source->modifier_state);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EV_SYN:
|
case EV_SYN:
|
||||||
@ -252,6 +255,7 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
|
|||||||
{
|
{
|
||||||
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
|
GSource *source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
|
||||||
ClutterEventSource *event_source = (ClutterEventSource *) source;
|
ClutterEventSource *event_source = (ClutterEventSource *) source;
|
||||||
|
ClutterInputDeviceType type;
|
||||||
const gchar *node_path;
|
const gchar *node_path;
|
||||||
gint fd;
|
gint fd;
|
||||||
|
|
||||||
@ -272,18 +276,24 @@ clutter_event_source_new (ClutterInputDeviceEvdev *input_device)
|
|||||||
event_source->event_poll_fd.fd = fd;
|
event_source->event_poll_fd.fd = fd;
|
||||||
event_source->event_poll_fd.events = G_IO_IN;
|
event_source->event_poll_fd.events = G_IO_IN;
|
||||||
|
|
||||||
/* create the xkb description */
|
type =
|
||||||
event_source->xkb = _clutter_xkb_desc_new (NULL,
|
clutter_input_device_get_device_type (CLUTTER_INPUT_DEVICE (input_device));
|
||||||
option_xkb_layout,
|
|
||||||
option_xkb_variant,
|
if (type == CLUTTER_KEYBOARD_DEVICE)
|
||||||
option_xkb_options);
|
|
||||||
if (G_UNLIKELY (event_source->xkb == NULL))
|
|
||||||
{
|
{
|
||||||
g_warning ("Could not compile keymap %s:%s:%s", option_xkb_layout,
|
/* create the xkb description */
|
||||||
option_xkb_variant, option_xkb_options);
|
event_source->xkb = _clutter_xkb_desc_new (NULL,
|
||||||
close (fd);
|
option_xkb_layout,
|
||||||
g_source_unref (source);
|
option_xkb_variant,
|
||||||
return NULL;
|
option_xkb_options);
|
||||||
|
if (G_UNLIKELY (event_source->xkb == NULL))
|
||||||
|
{
|
||||||
|
g_warning ("Could not compile keymap %s:%s:%s", option_xkb_layout,
|
||||||
|
option_xkb_variant, option_xkb_options);
|
||||||
|
close (fd);
|
||||||
|
g_source_unref (source);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and finally configure and attach the GSource */
|
/* and finally configure and attach the GSource */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user