diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2017-10-13 10:38:05 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2017-11-16 14:14:31 +0100 |
commit | 76b064cffc78fa41ba79b2fe55c1de8847a38467 (patch) | |
tree | 07cca2804a562af48cfb913caaece7c8bedfbc0e /clutter/clutter/evdev | |
parent | 333b5d12a035f85d9f88ae4396e05cc8f5b96c21 (diff) | |
download | mutter-76b064cffc78fa41ba79b2fe55c1de8847a38467.tar.gz |
clutter/evdev: Implement a11y configuration hooks
Apply the keyboard accessibility settings to the master keyboard.
https://bugzilla.gnome.org/show_bug.cgi?id=788564
Diffstat (limited to 'clutter/clutter/evdev')
-rw-r--r-- | clutter/clutter/evdev/clutter-device-manager-evdev.c | 13 | ||||
-rw-r--r-- | clutter/clutter/evdev/clutter-input-device-evdev.c | 23 | ||||
-rw-r--r-- | clutter/clutter/evdev/clutter-input-device-evdev.h | 6 |
3 files changed, 42 insertions, 0 deletions
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 @@ -210,6 +210,28 @@ clutter_input_device_evdev_is_grouped (ClutterInputDevice *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) { GObjectClass *object_class = G_OBJECT_CLASS (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__ */ |