From 2f072af02b7d8c076d2357b73cc89de5e1b59122 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 28 Aug 2019 10:55:16 +0300 Subject: [PATCH] clutter/input-pointer-a11y: Restore pointer a11y on resume When suspending, the devices are removed and the virtual device associated with the corresponding core pointer is disposed. Add the pointer accessibility virtual device to the core pointer on resume to restore pointer accessibility on resume if enabled. https://gitlab.gnome.org/GNOME/mutter/merge_requests/761 --- clutter/clutter/clutter-device-manager-private.h | 2 ++ clutter/clutter/clutter-device-manager.c | 14 ++++++++++++++ src/backends/native/meta-backend-native.c | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/clutter/clutter/clutter-device-manager-private.h b/clutter/clutter/clutter-device-manager-private.h index 7aaf79b4c..5a2e6e6be 100644 --- a/clutter/clutter/clutter-device-manager-private.h +++ b/clutter/clutter/clutter-device-manager-private.h @@ -210,6 +210,8 @@ ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceMa void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger, ClutterEvent *event, const ClutterEvent *to_discard); +CLUTTER_EXPORT +void clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager); /* input device */ CLUTTER_EXPORT diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c index 33d488a8d..71e615bf5 100644 --- a/clutter/clutter/clutter-device-manager.c +++ b/clutter/clutter/clutter-device-manager.c @@ -607,6 +607,20 @@ _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager, manager_class->compress_motion (device_manager, event, to_discard); } +void +clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager) +{ + ClutterInputDevice *core_pointer; + + core_pointer = clutter_device_manager_get_core_device (device_manager, + CLUTTER_POINTER_DEVICE); + if (core_pointer) + { + if (_clutter_is_input_pointer_a11y_enabled (core_pointer)) + _clutter_input_pointer_a11y_add_device (core_pointer); + } +} + static gboolean are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a, ClutterKbdA11ySettings *b) diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index 0ef6e4231..2ae5165ec 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -821,6 +821,7 @@ void meta_backend_native_resume (MetaBackendNative *native) META_MONITOR_MANAGER_KMS (monitor_manager); MetaInputSettings *input_settings; MetaIdleMonitor *idle_monitor; + ClutterDeviceManager *device_manager; COGL_TRACE_BEGIN_SCOPED (MetaBackendNativeResume, "Backend (resume)"); @@ -839,4 +840,7 @@ void meta_backend_native_resume (MetaBackendNative *native) input_settings = meta_backend_get_input_settings (backend); meta_input_settings_maybe_restore_numlock_state (input_settings); + + device_manager = clutter_device_manager_get_default (); + clutter_device_manager_ensure_a11y_state (device_manager); }