clutter/evdev: Fix toggling accessibility features from keyboard

Enabling keyboard accessibility features on Wayland from the keyboard
was wrongly assumed to be controlled by the "togglekeys" setting,
whereas it should be simply controlled by the "enable" setting.

As "togglekeys" is off by default and doesn't have a UI option to
enable, that would prevent turning on or off the keyboard accessibility
features using the keyboard.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/501
This commit is contained in:
Olivier Fourdan 2019-03-20 18:32:28 +01:00
parent f0b9654deb
commit 5c27bf6a2b

View File

@ -676,7 +676,7 @@ stop_toggle_slowkeys (ClutterInputDeviceEvdev *device)
}
static void
handle_togglekeys_press (ClutterEvent *event,
handle_enablekeys_press (ClutterEvent *event,
ClutterInputDeviceEvdev *device)
{
if (event->key.keyval == XKB_KEY_Shift_L || event->key.keyval == XKB_KEY_Shift_R)
@ -698,7 +698,7 @@ handle_togglekeys_press (ClutterEvent *event,
}
static void
handle_togglekeys_release (ClutterEvent *event,
handle_enablekeys_release (ClutterEvent *event,
ClutterInputDeviceEvdev *device)
{
if (event->key.keyval == XKB_KEY_Shift_L || event->key.keyval == XKB_KEY_Shift_R)
@ -1135,6 +1135,11 @@ clutter_input_device_evdev_process_kbd_a11y_event (ClutterEvent *e
if (!device_evdev->a11y_flags & CLUTTER_A11Y_KEYBOARD_ENABLED)
goto emit_event;
if (event->type == CLUTTER_KEY_PRESS)
handle_enablekeys_press (event, device_evdev);
else
handle_enablekeys_release (event, device_evdev);
if (device_evdev->a11y_flags & CLUTTER_A11Y_MOUSE_KEYS_ENABLED)
{
if (event->type == CLUTTER_KEY_PRESS &&
@ -1145,14 +1150,6 @@ clutter_input_device_evdev_process_kbd_a11y_event (ClutterEvent *e
return; /* swallow event */
}
if (device_evdev->a11y_flags & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED)
{
if (event->type == CLUTTER_KEY_PRESS)
handle_togglekeys_press (event, device_evdev);
else
handle_togglekeys_release (event, device_evdev);
}
if ((device_evdev->a11y_flags & CLUTTER_A11Y_BOUNCE_KEYS_ENABLED) &&
(get_debounce_delay (device) != 0))
{