[mutter/wip/carlosg/clutter-seat: 9/14] clutter: Move keyboard a11y from ClutterDeviceManager to ClutterSeat



commit 5d34967847072305a3804a6d6f012712e6596f8a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Oct 1 18:45:43 2019 +0200

    clutter: Move keyboard a11y from ClutterDeviceManager to ClutterSeat

 clutter/clutter/clutter-device-manager.c         | 81 ----------------------
 clutter/clutter/clutter-device-manager.h         | 29 --------
 clutter/clutter/clutter-seat.c                   | 88 ++++++++++++++++++++++++
 clutter/clutter/clutter-seat.h                   | 29 ++++++++
 src/backends/meta-input-settings.c               |  4 +-
 src/backends/native/meta-device-manager-native.c | 13 ----
 src/backends/native/meta-input-device-native.c   | 12 ++--
 src/backends/native/meta-seat-native.c           | 13 ++++
 src/backends/x11/meta-clutter-backend-x11.c      |  8 +--
 src/backends/x11/meta-device-manager-x11.c       |  5 --
 src/backends/x11/meta-seat-x11.c                 |  4 ++
 src/backends/x11/meta-xkb-a11y-x11.c             | 25 +++----
 src/backends/x11/meta-xkb-a11y-x11.h             |  6 +-
 src/wayland/meta-wayland-keyboard.c              |  4 +-
 14 files changed, 164 insertions(+), 157 deletions(-)
---
diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c
index 71e615bf5..03b97772f 100644
--- a/clutter/clutter/clutter-device-manager.c
+++ b/clutter/clutter/clutter-device-manager.c
@@ -54,8 +54,6 @@ struct _ClutterDeviceManagerPrivate
   /* back-pointer to the backend */
   ClutterBackend *backend;
 
-  /* Keyboard a11y */
-  ClutterKbdA11ySettings kbd_a11y_settings;
   /* Pointer a11y */
   ClutterPointerA11ySettings pointer_a11y_settings;
 };
@@ -76,8 +74,6 @@ enum
   DEVICE_ADDED,
   DEVICE_REMOVED,
   TOOL_CHANGED,
-  KBD_A11Y_MASK_CHANGED,
-  KBD_A11Y_FLAGS_CHANGED,
   PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
   PTR_A11Y_TIMEOUT_STARTED,
   PTR_A11Y_TIMEOUT_STOPPED,
@@ -197,46 +193,6 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
                   CLUTTER_TYPE_INPUT_DEVICE,
                   CLUTTER_TYPE_INPUT_DEVICE_TOOL);
 
-  /**
-   * ClutterDeviceManager::kbd-a11y-mods-state-changed:
-   * @manager: the #ClutterDeviceManager that emitted the signal
-   * @latched_mask: the latched modifier mask from stickykeys
-   * @locked_mask:  the locked modifier mask from stickykeys
-   *
-   * The ::kbd-a11y-mods-state-changed signal is emitted each time either the
-   * latched modifiers mask or locked modifiers mask are changed as the
-   * result of keyboard accessibilty's sticky keys operations.
-   */
-  manager_signals[KBD_A11Y_MASK_CHANGED] =
-    g_signal_new (I_("kbd-a11y-mods-state-changed"),
-                  G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_LAST,
-                  0, NULL, NULL,
-                  _clutter_marshal_VOID__UINT_UINT,
-                  G_TYPE_NONE, 2,
-                  G_TYPE_UINT,
-                  G_TYPE_UINT);
-
-  /**
-   * ClutterDeviceManager::kbd-a11y-flags-changed:
-   * @manager: the #ClutterDeviceManager that emitted the signal
-   * @settings_flags: the new ClutterKeyboardA11yFlags configuration
-   * @changed_mask: the ClutterKeyboardA11yFlags changed
-   *
-   * The ::kbd-a11y-flags-changed signal is emitted each time the
-   * ClutterKeyboardA11yFlags configuration is changed as the result of
-   * keyboard accessibilty operations.
-   */
-  manager_signals[KBD_A11Y_FLAGS_CHANGED] =
-    g_signal_new (I_("kbd-a11y-flags-changed"),
-                  G_TYPE_FROM_CLASS (klass),
-                  G_SIGNAL_RUN_LAST,
-                  0, NULL, NULL,
-                  _clutter_marshal_VOID__UINT_UINT,
-                  G_TYPE_NONE, 2,
-                  G_TYPE_UINT,
-                  G_TYPE_UINT);
-
   /**
    * ClutterDeviceManager::ptr-a11y-dwell-click-type-changed:
    * @manager: the #ClutterDeviceManager that emitted the signal
@@ -621,43 +577,6 @@ clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
     }
 }
 
-static gboolean
-are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
-                             ClutterKbdA11ySettings *b)
-{
-  return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
-}
-
-void
-clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                              ClutterKbdA11ySettings *settings)
-{
-  ClutterDeviceManagerClass *manager_class;
-  ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
-
-  g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
-
-  if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
-    return;
-
-  priv->kbd_a11y_settings = *settings;
-
-  manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
-  if (manager_class->apply_kbd_a11y_settings)
-    manager_class->apply_kbd_a11y_settings (device_manager, settings);
-}
-
-void
-clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                              ClutterKbdA11ySettings *settings)
-{
-  ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
-
-  g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
-
-  *settings = priv->kbd_a11y_settings;
-}
-
 static gboolean
 are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
                                  ClutterPointerA11ySettings *b)
diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h
index acac4f9da..057473f4c 100644
--- a/clutter/clutter/clutter-device-manager.h
+++ b/clutter/clutter/clutter-device-manager.h
@@ -51,24 +51,6 @@ typedef enum _ClutterVirtualDeviceType
   CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
 } ClutterVirtualDeviceType;
 
-/**
- * ClutterKbdA11ySettings:
- *
- * The #ClutterKbdA11ySettings structure contains keyboard accessibility
- * settings
- *
- */
-typedef struct _ClutterKbdA11ySettings
-{
-  ClutterKeyboardA11yFlags controls;
-  gint slowkeys_delay;
-  gint debounce_delay;
-  gint timeout_delay;
-  gint mousekeys_init_delay;
-  gint mousekeys_max_speed;
-  gint mousekeys_accel_time;
-} ClutterKbdA11ySettings;
-
 /**
  * ClutterPointerA11ySettings:
  *
@@ -120,9 +102,6 @@ struct _ClutterDeviceManagerClass
   void                (* compress_motion) (ClutterDeviceManager *device_manger,
                                            ClutterEvent         *event,
                                            const ClutterEvent   *to_discard);
-  /* Keyboard accessbility */
-  void                (* apply_kbd_a11y_settings) (ClutterDeviceManager   *device_manger,
-                                                   ClutterKbdA11ySettings *settings);
 
   /* padding */
   gpointer _padding[4];
@@ -149,14 +128,6 @@ ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (Clutter
 CLUTTER_EXPORT
 ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager 
*device_manager);
 
-CLUTTER_EXPORT
-void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                                   ClutterKbdA11ySettings *settings);
-
-CLUTTER_EXPORT
-void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                                   ClutterKbdA11ySettings *settings);
-
 CLUTTER_EXPORT
 void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager       *device_manager,
                                                        ClutterPointerA11ySettings *settings);
diff --git a/clutter/clutter/clutter-seat.c b/clutter/clutter/clutter-seat.c
index 95653b485..2d23520eb 100644
--- a/clutter/clutter/clutter-seat.c
+++ b/clutter/clutter/clutter-seat.c
@@ -34,6 +34,8 @@ enum
   DEVICE_ADDED,
   DEVICE_REMOVED,
   TOOL_CHANGED,
+  KBD_A11Y_MASK_CHANGED,
+  KBD_A11Y_FLAGS_CHANGED,
   N_SIGNALS,
 };
 
@@ -53,6 +55,9 @@ typedef struct _ClutterSeatPrivate ClutterSeatPrivate;
 struct _ClutterSeatPrivate
 {
   ClutterBackend *backend;
+
+  /* Keyboard a11y */
+  ClutterKbdA11ySettings kbd_a11y_settings;
 };
 
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterSeat, clutter_seat, G_TYPE_OBJECT)
@@ -151,6 +156,52 @@ clutter_seat_class_init (ClutterSeatClass *klass)
                               G_TYPE_FROM_CLASS (object_class),
                               _clutter_marshal_VOID__OBJECT_OBJECTv);
 
+  /**
+   * ClutterSeat::kbd-a11y-mods-state-changed:
+   * @seat: the #ClutterSeat that emitted the signal
+   * @latched_mask: the latched modifier mask from stickykeys
+   * @locked_mask:  the locked modifier mask from stickykeys
+   *
+   * The ::kbd-a11y-mods-state-changed signal is emitted each time either the
+   * latched modifiers mask or locked modifiers mask are changed as the
+   * result of keyboard accessibilty's sticky keys operations.
+   */
+  signals[KBD_A11Y_MASK_CHANGED] =
+    g_signal_new (I_("kbd-a11y-mods-state-changed"),
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  _clutter_marshal_VOID__UINT_UINT,
+                  G_TYPE_NONE, 2,
+                  G_TYPE_UINT,
+                  G_TYPE_UINT);
+  g_signal_set_va_marshaller (signals[KBD_A11Y_MASK_CHANGED],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_VOID__UINT_UINTv);
+
+  /**
+   * ClutterSeat::kbd-a11y-flags-changed:
+   * @seat: the #ClutterSeat that emitted the signal
+   * @settings_flags: the new ClutterKeyboardA11yFlags configuration
+   * @changed_mask: the ClutterKeyboardA11yFlags changed
+   *
+   * The ::kbd-a11y-flags-changed signal is emitted each time the
+   * ClutterKeyboardA11yFlags configuration is changed as the result of
+   * keyboard accessibility operations.
+   */
+  signals[KBD_A11Y_FLAGS_CHANGED] =
+    g_signal_new (I_("kbd-a11y-flags-changed"),
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0, NULL, NULL,
+                  _clutter_marshal_VOID__UINT_UINT,
+                  G_TYPE_NONE, 2,
+                  G_TYPE_UINT,
+                  G_TYPE_UINT);
+  g_signal_set_va_marshaller (signals[KBD_A11Y_FLAGS_CHANGED],
+                              G_TYPE_FROM_CLASS (object_class),
+                              _clutter_marshal_VOID__UINT_UINTv);
+
   props[PROP_BACKEND] =
     g_param_spec_object ("backend",
                          P_("Backend"),
@@ -233,3 +284,40 @@ clutter_seat_get_keymap (ClutterSeat *seat)
 {
   return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
 }
+
+static gboolean
+are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
+                             ClutterKbdA11ySettings *b)
+{
+  return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
+}
+
+void
+clutter_seat_set_kbd_a11y_settings (ClutterSeat            *seat,
+                                    ClutterKbdA11ySettings *settings)
+{
+  ClutterSeatClass *seat_class;
+  ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
+
+  g_return_if_fail (CLUTTER_IS_SEAT (seat));
+
+  if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
+    return;
+
+  priv->kbd_a11y_settings = *settings;
+
+  seat_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (seat);
+  if (seat_class->apply_kbd_a11y_settings)
+    seat_class->apply_kbd_a11y_settings (seat, settings);
+}
+
+void
+clutter_seat_get_kbd_a11y_settings (ClutterSeat            *seat,
+                                    ClutterKbdA11ySettings *settings)
+{
+  ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
+
+  g_return_if_fail (CLUTTER_IS_SEAT (seat));
+
+  *settings = priv->kbd_a11y_settings;
+}
diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h
index a232670a8..045dcb3ef 100644
--- a/clutter/clutter/clutter-seat.h
+++ b/clutter/clutter/clutter-seat.h
@@ -36,6 +36,24 @@ CLUTTER_EXPORT
 G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
                          CLUTTER, SEAT, GObject)
 
+/**
+ * ClutterKbdA11ySettings:
+ *
+ * The #ClutterKbdA11ySettings structure contains keyboard accessibility
+ * settings
+ *
+ */
+typedef struct _ClutterKbdA11ySettings
+{
+  ClutterKeyboardA11yFlags controls;
+  gint slowkeys_delay;
+  gint debounce_delay;
+  gint timeout_delay;
+  gint mousekeys_init_delay;
+  gint mousekeys_max_speed;
+  gint mousekeys_accel_time;
+} ClutterKbdA11ySettings;
+
 typedef struct _ClutterSeatClass ClutterSeatClass;
 
 struct _ClutterSeatClass
@@ -58,6 +76,10 @@ struct _ClutterSeatClass
                             ClutterEvent       *dest);
   void (* free_event_data) (ClutterSeat        *seat,
                             ClutterEvent       *event);
+
+  /* Keyboard accessibility */
+  void (* apply_kbd_a11y_settings) (ClutterSeat            *seat,
+                                    ClutterKbdA11ySettings *settings);
 };
 
 CLUTTER_EXPORT
@@ -73,4 +95,11 @@ void clutter_seat_bell_notify (ClutterSeat *seat);
 CLUTTER_EXPORT
 ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
 
+CLUTTER_EXPORT
+void clutter_seat_set_kbd_a11y_settings (ClutterSeat            *seat,
+                                         ClutterKbdA11ySettings *settings);
+CLUTTER_EXPORT
+void clutter_seat_get_kbd_a11y_settings (ClutterSeat            *seat,
+                                         ClutterKbdA11ySettings *settings);
+
 #endif /* CLUTTER_SEAT_H */
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index a41ec3147..7bd4a3153 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -1222,6 +1222,8 @@ load_keyboard_a11y_settings (MetaInputSettings  *input_settings,
   MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings);
   ClutterKbdA11ySettings kbd_a11y_settings = { 0 };
   ClutterInputDevice *core_keyboard;
+  ClutterBackend *backend = clutter_get_default_backend ();
+  ClutterSeat *seat = clutter_backend_get_default_seat (backend);
   guint i;
 
   core_keyboard = clutter_device_manager_get_core_device (priv->device_manager, CLUTTER_KEYBOARD_DEVICE);
@@ -1248,7 +1250,7 @@ load_keyboard_a11y_settings (MetaInputSettings  *input_settings,
   kbd_a11y_settings.mousekeys_accel_time = g_settings_get_int (priv->keyboard_a11y_settings,
                                                                "mousekeys-accel-time");
 
-  clutter_device_manager_set_kbd_a11y_settings (priv->device_manager, &kbd_a11y_settings);
+  clutter_seat_set_kbd_a11y_settings (seat, &kbd_a11y_settings);
 }
 
 static void
diff --git a/src/backends/native/meta-device-manager-native.c 
b/src/backends/native/meta-device-manager-native.c
index cb7144f15..04e43fa9d 100644
--- a/src/backends/native/meta-device-manager-native.c
+++ b/src/backends/native/meta-device-manager-native.c
@@ -175,18 +175,6 @@ meta_device_manager_native_compress_motion (ClutterDeviceManager *device_manger,
                                          dy_unaccel + dst_dy_unaccel);
 }
 
-static void
-meta_device_manager_native_apply_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                                    ClutterKbdA11ySettings *settings)
-{
-  ClutterInputDevice *device;
-
-  device = meta_device_manager_native_get_core_device (device_manager, CLUTTER_KEYBOARD_DEVICE);
-  if (device)
-    meta_input_device_native_apply_kbd_a11y_settings (META_INPUT_DEVICE_NATIVE (device),
-                                                      settings);
-}
-
 /*
  * GObject implementation
  */
@@ -204,7 +192,6 @@ meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
   manager_class->create_virtual_device = meta_device_manager_native_create_virtual_device;
   manager_class->get_supported_virtual_device_types = 
meta_device_manager_native_get_supported_virtual_device_types;
   manager_class->compress_motion = meta_device_manager_native_compress_motion;
-  manager_class->apply_kbd_a11y_settings = meta_device_manager_native_apply_kbd_a11y_settings;
 }
 
 static void
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index a09dae5a4..4293f5af4 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -250,10 +250,11 @@ clear_slow_keys (MetaInputDeviceNative *device)
 static guint
 get_slow_keys_delay (ClutterInputDevice *device)
 {
+  MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
   ClutterKbdA11ySettings a11y_settings;
 
-  clutter_device_manager_get_kbd_a11y_settings (device->device_manager,
-                                                &a11y_settings);
+  clutter_seat_get_kbd_a11y_settings (CLUTTER_SEAT (device_native->seat),
+                                      &a11y_settings);
   /* Settings use int, we use uint, make sure we dont go negative */
   return MAX (0, a11y_settings.slowkeys_delay);
 }
@@ -345,10 +346,11 @@ stop_slow_keys (ClutterEvent                *event,
 static guint
 get_debounce_delay (ClutterInputDevice *device)
 {
+  MetaInputDeviceNative *device_native = META_INPUT_DEVICE_NATIVE (device);
   ClutterKbdA11ySettings a11y_settings;
 
-  clutter_device_manager_get_kbd_a11y_settings (device->device_manager,
-                                                &a11y_settings);
+  clutter_seat_get_kbd_a11y_settings (CLUTTER_SEAT (device_native->seat),
+                                      &a11y_settings);
   /* Settings use int, we use uint, make sure we dont go negative */
   return MAX (0, a11y_settings.debounce_delay);
 }
@@ -429,7 +431,7 @@ key_event_is_modifier (ClutterEvent *event)
 static void
 notify_stickykeys_mask (MetaInputDeviceNative *device)
 {
-  g_signal_emit_by_name (CLUTTER_INPUT_DEVICE (device)->device_manager,
+  g_signal_emit_by_name (device->seat,
                          "kbd-a11y-mods-state-changed",
                          device->stickykeys_latched_mask,
                          device->stickykeys_locked_mask);
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index 3a7a054ef..67b9f176d 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -2558,6 +2558,18 @@ meta_seat_native_free_event_data (ClutterSeat  *seat,
     meta_event_native_free (event_evdev);
 }
 
+static void
+meta_seat_native_apply_kbd_a11y_settings (ClutterSeat            *seat,
+                                          ClutterKbdA11ySettings *settings)
+{
+  ClutterInputDevice *device;
+
+  device = clutter_seat_get_keyboard (seat);
+  if (device)
+    meta_input_device_native_apply_kbd_a11y_settings (META_INPUT_DEVICE_NATIVE (device),
+                                                      settings);
+}
+
 static void
 meta_seat_native_class_init (MetaSeatNativeClass *klass)
 {
@@ -2577,6 +2589,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
   seat_class->get_keymap = meta_seat_native_get_keymap;
   seat_class->copy_event_data = meta_seat_native_copy_event_data;
   seat_class->free_event_data = meta_seat_native_free_event_data;
+  seat_class->apply_kbd_a11y_settings = meta_seat_native_apply_kbd_a11y_settings;
 
   props[PROP_SEAT_ID] =
     g_param_spec_string ("seat-id",
diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c
index 5e8ada183..7dc1fd18c 100644
--- a/src/backends/x11/meta-clutter-backend-x11.c
+++ b/src/backends/x11/meta-clutter-backend-x11.c
@@ -115,14 +115,14 @@ static void
 on_keymap_state_change (MetaKeymapX11 *keymap_x11,
                         gpointer       data)
 {
-  ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
+  ClutterSeat *seat = CLUTTER_SEAT (data);
   ClutterKbdA11ySettings kbd_a11y_settings;
 
   /* On keymaps state change, just reapply the current settings, it'll
    * take care of enabling/disabling mousekeys based on NumLock state.
    */
-  clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
-  meta_device_manager_x11_apply_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
+  clutter_seat_get_kbd_a11y_settings (seat, &kbd_a11y_settings);
+  meta_seat_x11_apply_kbd_a11y_settings (seat, &kbd_a11y_settings);
 }
 
 static void
@@ -163,7 +163,7 @@ meta_clutter_backend_x11_init_events (ClutterBackend *backend)
   g_signal_connect (clutter_seat_get_keymap (CLUTTER_SEAT (backend_x11->core_seat)),
                     "state-changed",
                     G_CALLBACK (on_keymap_state_change),
-                    backend_x11->device_manager);
+                    backend_x11->core_seat);
 }
 
 static ClutterSeat *
diff --git a/src/backends/x11/meta-device-manager-x11.c b/src/backends/x11/meta-device-manager-x11.c
index b58fb3a50..461d24ad9 100644
--- a/src/backends/x11/meta-device-manager-x11.c
+++ b/src/backends/x11/meta-device-manager-x11.c
@@ -31,7 +31,6 @@
 #include "backends/x11/meta-seat-x11.h"
 #include "backends/x11/meta-stage-x11.h"
 #include "backends/x11/meta-virtual-input-device-x11.h"
-#include "backends/x11/meta-xkb-a11y-x11.h"
 #include "clutter/clutter-mutter.h"
 #include "clutter/x11/clutter-x11.h"
 #include "core/display-private.h"
@@ -196,7 +195,6 @@ on_tool_changed (ClutterSeat            *seat,
 static void
 meta_device_manager_x11_constructed (GObject *object)
 {
-  ClutterDeviceManager *manager = CLUTTER_DEVICE_MANAGER (object);
   MetaDeviceManagerX11 *manager_xi2 = META_DEVICE_MANAGER_X11 (object);
 
   g_signal_connect (manager_xi2->seat, "device-added",
@@ -206,8 +204,6 @@ meta_device_manager_x11_constructed (GObject *object)
   g_signal_connect (manager_xi2->seat, "tool-changed",
                     G_CALLBACK (on_tool_changed), manager_xi2);
 
-  meta_device_manager_x11_a11y_init (manager);
-
   if (G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed)
     G_OBJECT_CLASS (meta_device_manager_x11_parent_class)->constructed (object);
 }
@@ -277,7 +273,6 @@ meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
   manager_class->select_stage_events = meta_device_manager_x11_select_stage_events;
   manager_class->create_virtual_device = meta_device_manager_x11_create_virtual_device;
   manager_class->get_supported_virtual_device_types = 
meta_device_manager_x11_get_supported_virtual_device_types;
-  manager_class->apply_kbd_a11y_settings = meta_device_manager_x11_apply_kbd_a11y_settings;
 }
 
 static void
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index 9d2bc12dd..28ef6a7b0 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -25,6 +25,7 @@
 #include "backends/x11/meta-input-device-x11.h"
 #include "backends/x11/meta-keymap-x11.h"
 #include "backends/x11/meta-stage-x11.h"
+#include "backends/x11/meta-xkb-a11y-x11.h"
 #include "clutter/clutter-mutter.h"
 #include "clutter/x11/clutter-x11.h"
 #include "core/bell.h"
@@ -1399,6 +1400,8 @@ meta_seat_x11_constructed (GObject *object)
                     G_CALLBACK (on_keymap_state_change),
                     seat_x11);
 
+  meta_seat_x11_a11y_init (CLUTTER_SEAT (seat_x11));
+
   if (G_OBJECT_CLASS (meta_seat_x11_parent_class)->constructed)
     G_OBJECT_CLASS (meta_seat_x11_parent_class)->constructed (object);
 }
@@ -1506,6 +1509,7 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
   seat_class->get_keymap = meta_seat_x11_get_keymap;
   seat_class->copy_event_data = meta_seat_x11_copy_event_data;
   seat_class->free_event_data = meta_seat_x11_free_event_data;
+  seat_class->apply_kbd_a11y_settings = meta_seat_x11_apply_kbd_a11y_settings;
 
   props[PROP_OPCODE] =
     g_param_spec_int ("opcode",
diff --git a/src/backends/x11/meta-xkb-a11y-x11.c b/src/backends/x11/meta-xkb-a11y-x11.c
index c8e07b300..5deb6f3ff 100644
--- a/src/backends/x11/meta-xkb-a11y-x11.c
+++ b/src/backends/x11/meta-xkb-a11y-x11.c
@@ -75,7 +75,7 @@ set_xkb_desc_rec (Display    *xdisplay,
 }
 
 static void
-check_settings_changed (ClutterDeviceManager *device_manager)
+check_settings_changed (ClutterSeat *seat)
 {
   Display *xdisplay = clutter_x11_get_default_display ();
   ClutterKbdA11ySettings kbd_a11y_settings;
@@ -86,7 +86,7 @@ check_settings_changed (ClutterDeviceManager *device_manager)
   if (!desc)
     return;
 
-  clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
+  clutter_seat_get_kbd_a11y_settings (seat, &kbd_a11y_settings);
 
   if (desc->ctrls->enabled_ctrls & XkbSlowKeysMask &&
       !(kbd_a11y_settings.controls & CLUTTER_A11Y_SLOW_KEYS_ENABLED))
@@ -115,7 +115,7 @@ check_settings_changed (ClutterDeviceManager *device_manager)
     }
 
   if (what_changed)
-    g_signal_emit_by_name (device_manager,
+    g_signal_emit_by_name (seat,
                            "kbd-a11y-flags-changed",
                            kbd_a11y_settings.controls,
                            what_changed);
@@ -128,7 +128,7 @@ xkb_a11y_event_filter (XEvent       *xevent,
                        ClutterEvent *clutter_event,
                        gpointer      data)
 {
-  ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
+  ClutterSeat *seat = CLUTTER_SEAT (data);
   XkbEvent *xkbev = (XkbEvent *) xevent;
 
   /* 'event_type' is set to zero on notifying us of updates in
@@ -141,9 +141,9 @@ xkb_a11y_event_filter (XEvent       *xevent,
    */
   if (xevent->xany.type == (_xkb_event_base + XkbEventCode) &&
       xkbev->any.xkb_type == XkbControlsNotify && xkbev->ctrls.event_type != 0)
-    check_settings_changed (device_manager);
+    check_settings_changed (seat);
 
-  return  CLUTTER_X11_FILTER_CONTINUE;
+  return CLUTTER_X11_FILTER_CONTINUE;
 }
 
 static gboolean
@@ -194,11 +194,9 @@ set_xkb_ctrl (XkbDescRec               *desc,
 }
 
 void
-meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                                 ClutterKbdA11ySettings *kbd_a11y_settings)
+meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat            *seat,
+                                       ClutterKbdA11ySettings *kbd_a11y_settings)
 {
-  ClutterBackend *backend;
-  ClutterSeat *seat;
   Display *xdisplay = clutter_x11_get_default_display ();
   XkbDescRec *desc;
   gboolean enable_accessX;
@@ -207,9 +205,6 @@ meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager   *device_
   if (!desc)
     return;
 
-  backend = clutter_get_default_backend ();
-  seat = clutter_backend_get_default_seat (backend);
-
   /* general */
   enable_accessX = kbd_a11y_settings->controls & CLUTTER_A11Y_KEYBOARD_ENABLED;
 
@@ -318,7 +313,7 @@ meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager   *device_
 }
 
 gboolean
-meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
+meta_seat_x11_a11y_init (ClutterSeat *seat)
 {
   Display *xdisplay = clutter_x11_get_default_display ();
   guint event_mask;
@@ -330,7 +325,7 @@ meta_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
 
   XkbSelectEvents (xdisplay, XkbUseCoreKbd, event_mask, event_mask);
 
-  clutter_x11_add_filter (xkb_a11y_event_filter, device_manager);
+  clutter_x11_add_filter (xkb_a11y_event_filter, seat);
 
   return TRUE;
 }
diff --git a/src/backends/x11/meta-xkb-a11y-x11.h b/src/backends/x11/meta-xkb-a11y-x11.h
index 15e7243f1..7f11bf7b0 100644
--- a/src/backends/x11/meta-xkb-a11y-x11.h
+++ b/src/backends/x11/meta-xkb-a11y-x11.h
@@ -29,10 +29,10 @@
 #include "clutter/clutter.h"
 
 void
-meta_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager   *device_manager,
-                                                 ClutterKbdA11ySettings *kbd_a11y_settings);
+meta_seat_x11_apply_kbd_a11y_settings (ClutterSeat            *seat,
+                                       ClutterKbdA11ySettings *kbd_a11y_settings);
 
 gboolean
-meta_device_manager_x11_a11y_init               (ClutterDeviceManager *device_manager);
+meta_seat_x11_a11y_init               (ClutterSeat            *seat);
 
 #endif /* META_XKB_A11Y_X11_H */
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 0c3447137..c7a81d655 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -556,6 +556,7 @@ void
 meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
 {
   MetaBackend *backend = meta_get_backend ();
+  ClutterBackend *clutter_backend = clutter_get_default_backend ();
 
   keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
   g_signal_connect (keyboard->settings, "changed",
@@ -566,7 +567,8 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
   g_signal_connect (backend, "keymap-layout-group-changed",
                     G_CALLBACK (on_keymap_layout_group_changed), keyboard);
 
-  g_signal_connect (clutter_device_manager_get_default (), "kbd-a11y-mods-state-changed",
+  g_signal_connect (clutter_backend_get_default_seat (clutter_backend),
+                   "kbd-a11y-mods-state-changed",
                     G_CALLBACK (on_kbd_a11y_mask_changed), keyboard);
 
   meta_wayland_keyboard_take_keymap (keyboard, meta_backend_get_keymap (backend));


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