[mutter/wip/carlosg/clutter-seat: 53/68] clutter: Move virtual device management to ClutterSeat



commit e51713da64a5ec5616c6026a88404155b03ac8b1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Oct 2 14:40:40 2019 +0200

    clutter: Move virtual device management to ClutterSeat
    
    A11y in general may be considered a per-seat feature.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/852

 clutter/clutter/clutter-device-manager.c         | 39 ---------------------
 clutter/clutter/clutter-device-manager.h         | 21 ------------
 clutter/clutter/clutter-input-pointer-a11y.c     |  4 +--
 clutter/clutter/clutter-seat.c                   | 37 ++++++++++++++++++++
 clutter/clutter/clutter-seat.h                   | 23 +++++++++++++
 clutter/clutter/clutter-virtual-input-device.c   | 43 +++++++-----------------
 clutter/clutter/clutter-virtual-input-device.h   |  5 +--
 src/backends/meta-input-settings.c               | 10 ++++--
 src/backends/meta-remote-desktop-session.c       | 14 +++-----
 src/backends/meta-remote-desktop.c               |  6 ++--
 src/backends/native/meta-device-manager-native.c |  2 --
 src/backends/native/meta-input-device-native.c   |  5 ++-
 src/backends/native/meta-seat-native.c           | 21 ++++++++++++
 src/backends/x11/meta-device-manager-x11.c       | 19 -----------
 src/backends/x11/meta-seat-x11.c                 | 20 +++++++++++
 15 files changed, 134 insertions(+), 135 deletions(-)
---
diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c
index e93ceee6a..4efd2a803 100644
--- a/clutter/clutter/clutter-device-manager.c
+++ b/clutter/clutter/clutter-device-manager.c
@@ -45,9 +45,7 @@
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 #include "clutter-stage-private.h"
-#include "clutter-virtual-input-device.h"
 #include "clutter-input-device-tool.h"
-#include "clutter-input-pointer-a11y-private.h"
 
 struct _ClutterDeviceManagerPrivate
 {
@@ -440,43 +438,6 @@ _clutter_device_manager_get_backend (ClutterDeviceManager *manager)
   return priv->backend;
 }
 
-/**
- * clutter_device_manager_create_virtual_device:
- * @device_manager: a #ClutterDeviceManager
- * @device_type: the type of the virtual device
- *
- * Creates a virtual input device.
- *
- * Returns: (transfer full): a newly created virtual device
- **/
-ClutterVirtualInputDevice *
-clutter_device_manager_create_virtual_device (ClutterDeviceManager   *device_manager,
-                                              ClutterInputDeviceType  device_type)
-{
-  ClutterDeviceManagerClass *manager_class;
-
-  g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
-
-  manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
-  return manager_class->create_virtual_device (device_manager,
-                                               device_type);
-}
-
-/**
- * clutter_device_manager_supported_virtua_device_types: (skip)
- */
-ClutterVirtualDeviceType
-clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
-{
-  ClutterDeviceManagerClass *manager_class;
-
-  g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager),
-                        CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
-
-  manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
-  return manager_class->get_supported_virtual_device_types (device_manager);
-}
-
 void
 _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
                                          ClutterEvent         *event,
diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h
index 46b3227fb..902db3bc2 100644
--- a/clutter/clutter/clutter-device-manager.h
+++ b/clutter/clutter/clutter-device-manager.h
@@ -40,17 +40,6 @@ G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager,
 
 typedef struct _ClutterDeviceManagerPrivate     ClutterDeviceManagerPrivate;
 
-/**
- * ClutterVirtualDeviceType:
- */
-typedef enum _ClutterVirtualDeviceType
-{
-  CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
-  CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
-  CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
-  CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
-} ClutterVirtualDeviceType;
-
 /**
  * ClutterDeviceManagerClass:
  *
@@ -75,9 +64,6 @@ struct _ClutterDeviceManagerClass
                                            ClutterInputDevice     *device);
   void                (* select_stage_events) (ClutterDeviceManager *manager,
                                                ClutterStage       *stage);
-  ClutterVirtualInputDevice *(* create_virtual_device) (ClutterDeviceManager  *device_manager,
-                                                        ClutterInputDeviceType device_type);
-  ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterDeviceManager *device_manager);
   void                (* compress_motion) (ClutterDeviceManager *device_manger,
                                            ClutterEvent         *event,
                                            const ClutterEvent   *to_discard);
@@ -100,13 +86,6 @@ CLUTTER_EXPORT
 ClutterInputDevice *  clutter_device_manager_get_core_device (ClutterDeviceManager   *device_manager,
                                                               ClutterInputDeviceType  device_type);
 
-CLUTTER_EXPORT
-ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (ClutterDeviceManager  
*device_manager,
-                                                                         ClutterInputDeviceType device_type);
-
-CLUTTER_EXPORT
-ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_types (ClutterDeviceManager 
*device_manager);
-
 G_END_DECLS
 
 #endif /* __CLUTTER_DEVICE_MANAGER_H__ */
diff --git a/clutter/clutter/clutter-input-pointer-a11y.c b/clutter/clutter/clutter-input-pointer-a11y.c
index 33af9978c..9f2fc52b1 100644
--- a/clutter/clutter/clutter-input-pointer-a11y.c
+++ b/clutter/clutter/clutter-input-pointer-a11y.c
@@ -586,8 +586,8 @@ _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
     return;
 
   device->accessibility_virtual_device =
-    clutter_device_manager_create_virtual_device (device->device_manager,
-                                                  CLUTTER_POINTER_DEVICE);
+    clutter_seat_create_virtual_device (device->seat,
+                                        CLUTTER_POINTER_DEVICE);
 
   device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1);
 }
diff --git a/clutter/clutter/clutter-seat.c b/clutter/clutter/clutter-seat.c
index 16745ab2c..e4004ada1 100644
--- a/clutter/clutter/clutter-seat.c
+++ b/clutter/clutter/clutter-seat.c
@@ -29,6 +29,7 @@
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 #include "clutter-seat.h"
+#include "clutter-virtual-input-device.h"
 
 enum
 {
@@ -491,3 +492,39 @@ clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat
 
   priv->pointer_a11y_settings.dwell_click_type = click_type;
 }
+
+/**
+ * clutter_seat_create_virtual_device:
+ * @seat: a #ClutterSeat
+ * @device_type: the type of the virtual device
+ *
+ * Creates a virtual input device.
+ *
+ * Returns: (transfer full): a newly created virtual device
+ **/
+ClutterVirtualInputDevice *
+clutter_seat_create_virtual_device (ClutterSeat            *seat,
+                                    ClutterInputDeviceType  device_type)
+{
+  ClutterSeatClass *seat_class;
+
+  g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
+
+  seat_class = CLUTTER_SEAT_GET_CLASS (seat);
+  return seat_class->create_virtual_device (seat, device_type);
+}
+
+/**
+ * clutter_seat_supported_virtual_device_types: (skip)
+ */
+ClutterVirtualDeviceType
+clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
+{
+  ClutterSeatClass *seat_class;
+
+  g_return_val_if_fail (CLUTTER_IS_SEAT (seat),
+                        CLUTTER_VIRTUAL_DEVICE_TYPE_NONE);
+
+  seat_class = CLUTTER_SEAT_GET_CLASS (seat);
+  return seat_class->get_supported_virtual_device_types (seat);
+}
diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h
index 16d447eef..7fee59fac 100644
--- a/clutter/clutter/clutter-seat.h
+++ b/clutter/clutter/clutter-seat.h
@@ -29,6 +29,7 @@
 
 #include "clutter/clutter-types.h"
 #include "clutter/clutter-keymap.h"
+#include "clutter/clutter-virtual-input-device.h"
 
 #define CLUTTER_TYPE_SEAT (clutter_seat_get_type ())
 
@@ -75,6 +76,17 @@ typedef struct _ClutterPointerA11ySettings
   gint dwell_threshold;
 } ClutterPointerA11ySettings;
 
+/**
+ * ClutterVirtualDeviceType:
+ */
+typedef enum
+{
+  CLUTTER_VIRTUAL_DEVICE_TYPE_NONE = 0,
+  CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD = 1 << 0,
+  CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER = 1 << 1,
+  CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN = 1 << 2,
+} ClutterVirtualDeviceType;
+
 typedef struct _ClutterSeatClass ClutterSeatClass;
 
 struct _ClutterSeatClass
@@ -100,6 +112,11 @@ struct _ClutterSeatClass
   /* Keyboard accessibility */
   void (* apply_kbd_a11y_settings) (ClutterSeat            *seat,
                                     ClutterKbdA11ySettings *settings);
+
+  /* Virtual devices */
+  ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat            *seat,
+                                                         ClutterInputDeviceType  device_type);
+  ClutterVirtualDeviceType (* get_supported_virtual_device_types) (ClutterSeat *seat);
 };
 
 CLUTTER_EXPORT
@@ -134,5 +151,11 @@ void clutter_seat_get_pointer_a11y_settings (ClutterSeat                *seat,
 CLUTTER_EXPORT
 void clutter_seat_set_pointer_a11y_dwell_click_type (ClutterSeat                      *seat,
                                                      ClutterPointerA11yDwellClickType  click_type);
+CLUTTER_EXPORT
+ClutterVirtualInputDevice *clutter_seat_create_virtual_device (ClutterSeat            *seat,
+                                                               ClutterInputDeviceType  device_type);
+
+CLUTTER_EXPORT
+ClutterVirtualDeviceType clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat);
 
 #endif /* CLUTTER_SEAT_H */
diff --git a/clutter/clutter/clutter-virtual-input-device.c b/clutter/clutter/clutter-virtual-input-device.c
index 4e294af4b..522a6596f 100644
--- a/clutter/clutter/clutter-virtual-input-device.c
+++ b/clutter/clutter/clutter-virtual-input-device.c
@@ -27,15 +27,15 @@
 
 #include "clutter-virtual-input-device.h"
 
-#include "clutter-device-manager.h"
-#include "clutter-private.h"
 #include "clutter-enum-types.h"
+#include "clutter-private.h"
+#include "clutter-seat.h"
 
 enum
 {
   PROP_0,
 
-  PROP_DEVICE_MANAGER,
+  PROP_SEAT,
   PROP_DEVICE_TYPE,
 
   PROP_LAST
@@ -45,7 +45,7 @@ static GParamSpec *obj_props[PROP_LAST];
 
 typedef struct _ClutterVirtualInputDevicePrivate
 {
-  ClutterDeviceManager *manager;
+  ClutterSeat *seat;
   ClutterInputDeviceType device_type;
 } ClutterVirtualInputDevicePrivate;
 
@@ -181,23 +181,6 @@ clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *virtual
                           slot);
 }
 
-/**
- * clutter_virtual_input_device_get_manager:
- * @virtual_device: a virtual device
- *
- * Gets the device manager of this virtual device.
- *
- * Returns: (transfer none): The #ClutterDeviceManager of this virtual device
- **/
-ClutterDeviceManager *
-clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device)
-{
-  ClutterVirtualInputDevicePrivate *priv =
-    clutter_virtual_input_device_get_instance_private (virtual_device);
-
-  return priv->manager;
-}
-
 int
 clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device)
 {
@@ -220,8 +203,8 @@ clutter_virtual_input_device_get_property (GObject    *object,
 
   switch (prop_id)
     {
-    case PROP_DEVICE_MANAGER:
-      g_value_set_object (value, priv->manager);
+    case PROP_SEAT:
+      g_value_set_object (value, priv->seat);
       break;
     case PROP_DEVICE_TYPE:
       g_value_set_enum (value, priv->device_type);
@@ -245,8 +228,8 @@ clutter_virtual_input_device_set_property (GObject      *object,
 
   switch (prop_id)
     {
-    case PROP_DEVICE_MANAGER:
-      priv->manager = g_value_get_object (value);
+    case PROP_SEAT:
+      priv->seat = g_value_get_object (value);
       break;
     case PROP_DEVICE_TYPE:
       priv->device_type = g_value_get_enum (value);
@@ -270,11 +253,11 @@ clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
   object_class->get_property = clutter_virtual_input_device_get_property;
   object_class->set_property = clutter_virtual_input_device_set_property;
 
-  obj_props[PROP_DEVICE_MANAGER] =
-    g_param_spec_object ("device-manager",
-                         P_("Device Manager"),
-                         P_("The device manager instance"),
-                         CLUTTER_TYPE_DEVICE_MANAGER,
+  obj_props[PROP_SEAT] =
+    g_param_spec_object ("seat",
+                         P_("Seat"),
+                         P_("Seat"),
+                         CLUTTER_TYPE_SEAT,
                          CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
   obj_props[PROP_DEVICE_TYPE] =
     g_param_spec_enum ("device-type",
diff --git a/clutter/clutter/clutter-virtual-input-device.h b/clutter/clutter/clutter-virtual-input-device.h
index 450accda2..b829c04ad 100644
--- a/clutter/clutter/clutter-virtual-input-device.h
+++ b/clutter/clutter/clutter-virtual-input-device.h
@@ -27,7 +27,7 @@
 #include <glib-object.h>
 #include <stdint.h>
 
-#include "clutter-device-manager.h"
+#include "clutter-seat.h"
 
 #define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
 
@@ -169,9 +169,6 @@ void clutter_virtual_input_device_notify_touch_up (ClutterVirtualInputDevice *vi
                                                    uint64_t                   time_us,
                                                    int                        slot);
 
-CLUTTER_EXPORT
-ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device);
-
 CLUTTER_EXPORT
 int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device);
 
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index d67be8387..1d27aa003 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -2262,11 +2262,15 @@ meta_input_settings_emulate_keybinding (MetaInputSettings  *input_settings,
 
   if (!priv->virtual_pad_keyboard)
     {
-      ClutterDeviceManager *manager = clutter_device_manager_get_default ();
+      ClutterBackend *backend;
+      ClutterSeat *seat;
+
+      backend = clutter_get_default_backend ();
+      seat = clutter_backend_get_default_seat (backend);
 
       priv->virtual_pad_keyboard =
-        clutter_device_manager_create_virtual_device (manager,
-                                                      CLUTTER_KEYBOARD_DEVICE);
+        clutter_seat_create_virtual_device (seat,
+                                            CLUTTER_KEYBOARD_DEVICE);
     }
 
   state = is_press ? CLUTTER_KEY_STATE_PRESSED : CLUTTER_KEY_STATE_RELEASED;
diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c
index a7cc76aaa..059e1e878 100644
--- a/src/backends/meta-remote-desktop-session.c
+++ b/src/backends/meta-remote-desktop-session.c
@@ -116,8 +116,8 @@ static gboolean
 meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
                                    GError                  **error)
 {
-  ClutterDeviceManager *device_manager =
-    clutter_device_manager_get_default ();
+  ClutterBackend *backend = clutter_get_default_backend ();
+  ClutterSeat *seat = clutter_backend_get_default_seat (backend);
 
   g_assert (!session->virtual_pointer && !session->virtual_keyboard);
 
@@ -128,15 +128,11 @@ meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
     }
 
   session->virtual_pointer =
-    clutter_device_manager_create_virtual_device (device_manager,
-                                                  CLUTTER_POINTER_DEVICE);
+    clutter_seat_create_virtual_device (seat, CLUTTER_POINTER_DEVICE);
   session->virtual_keyboard =
-    clutter_device_manager_create_virtual_device (device_manager,
-                                                  CLUTTER_KEYBOARD_DEVICE);
-
+    clutter_seat_create_virtual_device (seat, CLUTTER_KEYBOARD_DEVICE);
   session->virtual_touchscreen =
-    clutter_device_manager_create_virtual_device (device_manager,
-                                                  CLUTTER_TOUCHSCREEN_DEVICE);
+    clutter_seat_create_virtual_device (seat, CLUTTER_TOUCHSCREEN_DEVICE);
 
   init_remote_access_handle (session);
 
diff --git a/src/backends/meta-remote-desktop.c b/src/backends/meta-remote-desktop.c
index d741dccd8..b94055885 100644
--- a/src/backends/meta-remote-desktop.c
+++ b/src/backends/meta-remote-desktop.c
@@ -234,14 +234,14 @@ meta_remote_desktop_new (MetaDbusSessionWatcher *session_watcher)
 static MetaRemoteDesktopDeviceTypes
 calculate_supported_device_types (void)
 {
-  ClutterDeviceManager *device_manager =
-    clutter_device_manager_get_default ();
+  ClutterBackend *backend = clutter_get_default_backend ();
+  ClutterSeat *seat = clutter_backend_get_default_seat (backend);
   ClutterVirtualDeviceType device_types;
   MetaRemoteDesktopDeviceTypes supported_devices =
     META_REMOTE_DESKTOP_DEVICE_TYPE_NONE;
 
   device_types =
-    clutter_device_manager_get_supported_virtual_device_types (device_manager);
+    clutter_seat_get_supported_virtual_device_types (seat);
 
   if (device_types & CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD)
     supported_devices |= META_REMOTE_DESKTOP_DEVICE_TYPE_KEYBOARD;
diff --git a/src/backends/native/meta-device-manager-native.c 
b/src/backends/native/meta-device-manager-native.c
index 2deeb7593..fa0b8feb3 100644
--- a/src/backends/native/meta-device-manager-native.c
+++ b/src/backends/native/meta-device-manager-native.c
@@ -188,8 +188,6 @@ meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
   manager_class->get_devices = meta_device_manager_native_get_devices;
   manager_class->get_core_device = meta_device_manager_native_get_core_device;
   manager_class->get_device = meta_device_manager_native_get_device;
-  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;
 }
 
diff --git a/src/backends/native/meta-input-device-native.c b/src/backends/native/meta-input-device-native.c
index 8757fe130..609c06000 100644
--- a/src/backends/native/meta-input-device-native.c
+++ b/src/backends/native/meta-input-device-native.c
@@ -851,7 +851,6 @@ static void
 enable_mousekeys (MetaInputDeviceNative *device_evdev)
 {
   ClutterInputDevice *device = CLUTTER_INPUT_DEVICE (device_evdev);
-  ClutterDeviceManager *manager = device->device_manager;
 
   device_evdev->mousekeys_btn = CLUTTER_BUTTON_PRIMARY;
   device_evdev->move_mousekeys_timer = 0;
@@ -863,8 +862,8 @@ enable_mousekeys (MetaInputDeviceNative *device_evdev)
     return;
 
   device->accessibility_virtual_device =
-    clutter_device_manager_create_virtual_device (manager,
-                                                  CLUTTER_POINTER_DEVICE);
+    clutter_seat_create_virtual_device (CLUTTER_SEAT (device_evdev->seat),
+                                        CLUTTER_POINTER_DEVICE);
 }
 
 static void
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index e3b93e7e1..369c203ab 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -37,6 +37,7 @@
 #include "backends/native/meta-input-device-native.h"
 #include "backends/native/meta-input-device-tool-native.h"
 #include "backends/native/meta-keymap-native.h"
+#include "backends/native/meta-virtual-input-device-native.h"
 #include "clutter/clutter-mutter.h"
 #include "core/bell.h"
 
@@ -2568,6 +2569,24 @@ meta_seat_native_apply_kbd_a11y_settings (ClutterSeat            *seat,
                                                       settings);
 }
 
+static ClutterVirtualInputDevice *
+meta_seat_native_create_virtual_device (ClutterSeat            *seat,
+                                        ClutterInputDeviceType  device_type)
+{
+  return g_object_new (META_TYPE_VIRTUAL_INPUT_DEVICE_NATIVE,
+                       "seat", seat,
+                       "device-type", device_type,
+                       NULL);
+}
+
+static ClutterVirtualDeviceType
+meta_seat_native_get_supported_virtual_device_types (ClutterSeat *seat)
+{
+  return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD |
+          CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER |
+          CLUTTER_VIRTUAL_DEVICE_TYPE_TOUCHSCREEN);
+}
+
 static void
 meta_seat_native_class_init (MetaSeatNativeClass *klass)
 {
@@ -2588,6 +2607,8 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
   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;
+  seat_class->create_virtual_device = meta_seat_native_create_virtual_device;
+  seat_class->get_supported_virtual_device_types = meta_seat_native_get_supported_virtual_device_types;
 
   props[PROP_SEAT_ID] =
     g_param_spec_string ("seat-id",
diff --git a/src/backends/x11/meta-device-manager-x11.c b/src/backends/x11/meta-device-manager-x11.c
index 461d24ad9..e78e2cdf7 100644
--- a/src/backends/x11/meta-device-manager-x11.c
+++ b/src/backends/x11/meta-device-manager-x11.c
@@ -228,23 +228,6 @@ meta_device_manager_x11_set_property (GObject      *object,
     }
 }
 
-static ClutterVirtualInputDevice *
-meta_device_manager_x11_create_virtual_device (ClutterDeviceManager   *manager,
-                                               ClutterInputDeviceType  device_type)
-{
-  return g_object_new (META_TYPE_VIRTUAL_INPUT_DEVICE_X11,
-                       "device-manager", manager,
-                       "device-type", device_type,
-                       NULL);
-}
-
-static ClutterVirtualDeviceType
-meta_device_manager_x11_get_supported_virtual_device_types (ClutterDeviceManager *device_manager)
-{
-  return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD |
-          CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER);
-}
-
 static void
 meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
 {
@@ -271,8 +254,6 @@ meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
   manager_class->get_core_device = meta_device_manager_x11_get_core_device;
   manager_class->get_device = meta_device_manager_x11_get_device;
   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;
 }
 
 static void
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index c18e8937f..3d4cb0ea5 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-virtual-input-device-x11.h"
 #include "backends/x11/meta-xkb-a11y-x11.h"
 #include "clutter/clutter-mutter.h"
 #include "clutter/x11/clutter-x11.h"
@@ -1482,6 +1483,23 @@ meta_seat_x11_free_event_data (ClutterSeat  *seat,
     meta_event_x11_free (event_x11);
 }
 
+static ClutterVirtualInputDevice *
+meta_seat_x11_create_virtual_device (ClutterSeat            *seat,
+                                     ClutterInputDeviceType  device_type)
+{
+  return g_object_new (META_TYPE_VIRTUAL_INPUT_DEVICE_X11,
+                       "seat", seat,
+                       "device-type", device_type,
+                       NULL);
+}
+
+static ClutterVirtualDeviceType
+meta_seat_x11_get_supported_virtual_device_types (ClutterSeat *seat)
+{
+  return (CLUTTER_VIRTUAL_DEVICE_TYPE_KEYBOARD |
+          CLUTTER_VIRTUAL_DEVICE_TYPE_POINTER);
+}
+
 static void
 meta_seat_x11_class_init (MetaSeatX11Class *klass)
 {
@@ -1501,6 +1519,8 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
   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;
+  seat_class->create_virtual_device = meta_seat_x11_create_virtual_device;
+  seat_class->get_supported_virtual_device_types = meta_seat_x11_get_supported_virtual_device_types;
 
   props[PROP_OPCODE] =
     g_param_spec_int ("opcode",


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