clutter-main: Add hooks to plug kbd accessibility

On X11, when AccessX is enabled, all X11 clients benefit from the
AccessX features, including gnome-shell/mutter, meaning that special
keys like the overview or other shortcuts are also affected.

To achieve the same in Wayland, we need to implement the same features
in clutter main rather than the Wayland backend, so that all depending
code within the compositor but also Wayland clients (which rely on the
compositor to get keyboard events) similarly benefit from the
accessibility features.

Add hooks to the clutter main loop to be able to implement such
features.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
This commit is contained in:
Olivier Fourdan 2017-10-12 15:14:51 +02:00
parent dc0fc65229
commit 7d5e08c843
2 changed files with 24 additions and 1 deletions

View File

@ -145,6 +145,9 @@ struct _ClutterInputDevice
guint is_enabled : 1;
};
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
ClutterInputDevice *device);
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
@ -163,6 +166,11 @@ struct _ClutterInputDeviceClass
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
/* Platform-dependent interface */

View File

@ -2089,6 +2089,21 @@ emit_keyboard_event (ClutterEvent *event,
}
}
static inline void
process_key_event (ClutterEvent *event,
ClutterInputDevice *device)
{
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
if (device_class->process_kbd_a11y_event)
{
device_class->process_kbd_a11y_event (event, device, emit_keyboard_event);
return;
}
emit_keyboard_event (event, device);
}
static gboolean
is_off_stage (ClutterActor *stage,
gfloat x,
@ -2176,7 +2191,7 @@ _clutter_process_event_details (ClutterActor *stage,
}
}
emit_keyboard_event (event, device);
process_key_event (event, device);
}
break;