diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c index f40746a2f..c1c933e9c 100644 --- a/clutter/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c @@ -1923,6 +1923,18 @@ clutter_device_manager_evdev_compress_motion (ClutterDeviceManager *device_mange dy_unaccel + dst_dy_unaccel); } +static void +clutter_device_manager_evdev_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager, + ClutterKbdA11ySettings *settings) +{ + ClutterInputDevice *device; + + device = clutter_device_manager_evdev_get_core_device (device_manager, CLUTTER_KEYBOARD_DEVICE); + if (device) + clutter_input_device_evdev_apply_kbd_a11y_settings (CLUTTER_INPUT_DEVICE_EVDEV (device), + settings); +} + /* * GObject implementation */ @@ -2065,6 +2077,7 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass) manager_class->get_device = clutter_device_manager_evdev_get_device; manager_class->create_virtual_device = clutter_device_manager_evdev_create_virtual_device; manager_class->compress_motion = clutter_device_manager_evdev_compress_motion; + manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings; } static void diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.c b/clutter/clutter/evdev/clutter-input-device-evdev.c index 5328c56d3..6dcb81866 100644 --- a/clutter/clutter/evdev/clutter-input-device-evdev.c +++ b/clutter/clutter/evdev/clutter-input-device-evdev.c @@ -209,6 +209,28 @@ clutter_input_device_evdev_is_grouped (ClutterInputDevice *device, libinput_device_get_device_group (other_libinput_device); } +static void +clutter_input_device_evdev_process_kbd_a11y_event (ClutterEvent *event, + ClutterInputDevice *device, + ClutterEmitInputDeviceEvent emit_event_func) +{ + ClutterInputDeviceEvdev *device_evdev = CLUTTER_INPUT_DEVICE_EVDEV (device); + + if (!device_evdev->a11y_flags & CLUTTER_A11Y_KEYBOARD_ENABLED) + goto emit_event; + +emit_event: + emit_event_func (event, device); +} + +void +clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *device, + ClutterKbdA11ySettings *settings) +{ + /* Keep our own copy of keyboard a11y features flags to see what changes */ + device->a11y_flags = settings->controls; +} + static void clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass) { @@ -223,6 +245,7 @@ clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass) klass->is_mode_switch_button = clutter_input_device_evdev_is_mode_switch_button; klass->get_group_n_modes = clutter_input_device_evdev_get_group_n_modes; klass->is_grouped = clutter_input_device_evdev_is_grouped; + klass->process_kbd_a11y_event = clutter_input_device_evdev_process_kbd_a11y_event; obj_props[PROP_DEVICE_MATRIX] = g_param_spec_boxed ("device-matrix", diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.h b/clutter/clutter/evdev/clutter-input-device-evdev.h index 4b1d676d4..b8ce76089 100644 --- a/clutter/clutter/evdev/clutter-input-device-evdev.h +++ b/clutter/clutter/evdev/clutter-input-device-evdev.h @@ -70,6 +70,9 @@ struct _ClutterInputDeviceEvdev cairo_matrix_t device_matrix; gdouble device_aspect_ratio; /* w:h */ gdouble output_ratio; /* w:h */ + + /* Keyboard a11y */ + ClutterKeyboardA11yFlags a11y_flags; }; GType _clutter_input_device_evdev_get_type (void) G_GNUC_CONST; @@ -111,6 +114,9 @@ void clutter_input_device_evdev_translate_coordinates (Clut gfloat *x, gfloat *y); +void clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *device, + ClutterKbdA11ySettings *settings); + G_END_DECLS #endif /* __CLUTTER_INPUT_DEVICE_EVDEV_H__ */