clutter/evdev: Implement a11y configuration hooks

Apply the keyboard accessibility settings to the master keyboard.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
This commit is contained in:
Olivier Fourdan 2017-10-13 10:38:05 +02:00
parent 333b5d12a0
commit 76b064cffc
3 changed files with 42 additions and 0 deletions

View File

@ -1923,6 +1923,18 @@ clutter_device_manager_evdev_compress_motion (ClutterDeviceManager *device_mange
dy_unaccel + dst_dy_unaccel); 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 * 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->get_device = clutter_device_manager_evdev_get_device;
manager_class->create_virtual_device = clutter_device_manager_evdev_create_virtual_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->compress_motion = clutter_device_manager_evdev_compress_motion;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings;
} }
static void static void

View File

@ -209,6 +209,28 @@ clutter_input_device_evdev_is_grouped (ClutterInputDevice *device,
libinput_device_get_device_group (other_libinput_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 static void
clutter_input_device_evdev_class_init (ClutterInputDeviceEvdevClass *klass) 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->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->get_group_n_modes = clutter_input_device_evdev_get_group_n_modes;
klass->is_grouped = clutter_input_device_evdev_is_grouped; 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] = obj_props[PROP_DEVICE_MATRIX] =
g_param_spec_boxed ("device-matrix", g_param_spec_boxed ("device-matrix",

View File

@ -70,6 +70,9 @@ struct _ClutterInputDeviceEvdev
cairo_matrix_t device_matrix; cairo_matrix_t device_matrix;
gdouble device_aspect_ratio; /* w:h */ gdouble device_aspect_ratio; /* w:h */
gdouble output_ratio; /* w:h */ gdouble output_ratio; /* w:h */
/* Keyboard a11y */
ClutterKeyboardA11yFlags a11y_flags;
}; };
GType _clutter_input_device_evdev_get_type (void) G_GNUC_CONST; 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 *x,
gfloat *y); gfloat *y);
void clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *device,
ClutterKbdA11ySettings *settings);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_EVDEV_H__ */ #endif /* __CLUTTER_INPUT_DEVICE_EVDEV_H__ */