[mutter] clutter/evdev: Implement a11y configuration hooks



commit 76b064cffc78fa41ba79b2fe55c1de8847a38467
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Fri Oct 13 10:38:05 2017 +0200

    clutter/evdev: Implement a11y configuration hooks
    
    Apply the keyboard accessibility settings to the master keyboard.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788564

 .../clutter/evdev/clutter-device-manager-evdev.c   |   13 +++++++++++
 clutter/clutter/evdev/clutter-input-device-evdev.c |   23 ++++++++++++++++++++
 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 f40746a..c1c933e 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 5328c56..6dcb818 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 4b1d676..b8ce760 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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]