From 02fc0b453374c21c76c3b2a83eb9edf5e18b110f Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 12 Jun 2019 11:59:41 +0200 Subject: [PATCH] clutter/evdev: Implement togglekeys notification Notify with a system sound when the modifiers lock state is changed. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/637 --- clutter/clutter/evdev/clutter-input-device-evdev.c | 7 +++++++ clutter/clutter/evdev/clutter-input-device-evdev.h | 1 + clutter/clutter/evdev/clutter-seat-evdev.c | 1 + 3 files changed, 9 insertions(+) diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.c b/clutter/clutter/evdev/clutter-input-device-evdev.c index 105d769fa..f315bfb60 100644 --- a/clutter/clutter/evdev/clutter-input-device-evdev.c +++ b/clutter/clutter/evdev/clutter-input-device-evdev.c @@ -1246,6 +1246,13 @@ clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *dev device->a11y_flags = settings->controls; } +void +clutter_evdev_a11y_maybe_notify_toggle_keys (ClutterInputDeviceEvdev *device) +{ + if (device->a11y_flags & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED) + clutter_input_device_evdev_bell_notify (); +} + static void release_device_touch_slot (gpointer value) { diff --git a/clutter/clutter/evdev/clutter-input-device-evdev.h b/clutter/clutter/evdev/clutter-input-device-evdev.h index d3cd45a44..f4515a7d3 100644 --- a/clutter/clutter/evdev/clutter-input-device-evdev.h +++ b/clutter/clutter/evdev/clutter-input-device-evdev.h @@ -150,6 +150,7 @@ void clutter_input_device_evdev_release_touch_state (Clutte void clutter_input_device_evdev_release_touch_slots (ClutterInputDeviceEvdev *device_evdev, uint64_t time_us); +void clutter_evdev_a11y_maybe_notify_toggle_keys (ClutterInputDeviceEvdev *); G_END_DECLS diff --git a/clutter/clutter/evdev/clutter-seat-evdev.c b/clutter/clutter/evdev/clutter-seat-evdev.c index 9e8e3ffb1..888db6e4f 100644 --- a/clutter/clutter/evdev/clutter-seat-evdev.c +++ b/clutter/clutter/evdev/clutter-seat-evdev.c @@ -326,6 +326,7 @@ clutter_seat_evdev_notify_key (ClutterSeatEvdev *seat, backend = clutter_get_default_backend (); g_signal_emit_by_name (clutter_backend_get_keymap (backend), "state-changed"); clutter_seat_evdev_sync_leds (seat); + clutter_evdev_a11y_maybe_notify_toggle_keys (CLUTTER_INPUT_DEVICE_EVDEV (seat->core_keyboard)); } if (state == 0 || /* key release */