[mutter/wip/carlosg/clutter-seat: 53/71] clutter: Move platform event data management to ClutterSeat



commit ccd88834abf1b58a0486d00fd4f58b570248e5e3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Oct 1 18:21:00 2019 +0200

    clutter: Move platform event data management to ClutterSeat
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/852

 clutter/clutter/clutter-backend.c                | 20 +++++++++----------
 clutter/clutter/clutter-device-manager.h         |  7 -------
 clutter/clutter/clutter-seat.h                   |  7 +++++++
 src/backends/native/meta-device-manager-native.c | 25 ------------------------
 src/backends/native/meta-seat-native.c           | 25 ++++++++++++++++++++++++
 src/backends/x11/meta-device-manager-x11.c       | 25 ------------------------
 src/backends/x11/meta-seat-x11.c                 | 25 ++++++++++++++++++++++++
 7 files changed, 67 insertions(+), 67 deletions(-)
---
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
index b9efe1cdc..36769a73d 100644
--- a/clutter/clutter/clutter-backend.c
+++ b/clutter/clutter/clutter-backend.c
@@ -770,24 +770,24 @@ _clutter_backend_copy_event_data (ClutterBackend     *backend,
                                   const ClutterEvent *src,
                                   ClutterEvent       *dest)
 {
-  ClutterDeviceManagerClass *device_manager_class;
-  ClutterDeviceManager *device_manager;
+  ClutterSeatClass *seat_class;
+  ClutterSeat *seat;
 
-  device_manager = clutter_device_manager_get_default ();
-  device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
-  device_manager_class->copy_event_data (device_manager, src, dest);
+  seat = clutter_backend_get_default_seat (backend);
+  seat_class = CLUTTER_SEAT_GET_CLASS (seat);
+  seat_class->copy_event_data (seat, src, dest);
 }
 
 void
 _clutter_backend_free_event_data (ClutterBackend *backend,
                                   ClutterEvent   *event)
 {
-  ClutterDeviceManagerClass *device_manager_class;
-  ClutterDeviceManager *device_manager;
+  ClutterSeatClass *seat_class;
+  ClutterSeat *seat;
 
-  device_manager = clutter_device_manager_get_default ();
-  device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
-  device_manager_class->free_event_data (device_manager, event);
+  seat = clutter_backend_get_default_seat (backend);
+  seat_class = CLUTTER_SEAT_GET_CLASS (seat);
+  seat_class->free_event_data (seat, event);
 }
 
 /**
diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h
index f539c7c73..acac4f9da 100644
--- a/clutter/clutter/clutter-device-manager.h
+++ b/clutter/clutter/clutter-device-manager.h
@@ -124,13 +124,6 @@ struct _ClutterDeviceManagerClass
   void                (* apply_kbd_a11y_settings) (ClutterDeviceManager   *device_manger,
                                                    ClutterKbdA11ySettings *settings);
 
-  /* Event platform data */
-  void (* copy_event_data) (ClutterDeviceManager *device_manager,
-                            const ClutterEvent   *src,
-                            ClutterEvent         *dest);
-  void (* free_event_data) (ClutterDeviceManager *device_manager,
-                            ClutterEvent         *event);
-
   /* padding */
   gpointer _padding[4];
 };
diff --git a/clutter/clutter/clutter-seat.h b/clutter/clutter/clutter-seat.h
index 425099102..e2bde1a21 100644
--- a/clutter/clutter/clutter-seat.h
+++ b/clutter/clutter/clutter-seat.h
@@ -50,6 +50,13 @@ struct _ClutterSeatClass
   void (* bell_notify) (ClutterSeat *seat);
 
   ClutterKeymap * (* get_keymap) (ClutterSeat *seat);
+
+  /* Event platform data */
+  void (* copy_event_data) (ClutterSeat        *seat,
+                            const ClutterEvent *src,
+                            ClutterEvent       *dest);
+  void (* free_event_data) (ClutterSeat        *seat,
+                            ClutterEvent       *event);
 };
 
 CLUTTER_EXPORT
diff --git a/src/backends/native/meta-device-manager-native.c 
b/src/backends/native/meta-device-manager-native.c
index 177e33c19..352eab866 100644
--- a/src/backends/native/meta-device-manager-native.c
+++ b/src/backends/native/meta-device-manager-native.c
@@ -53,29 +53,6 @@ G_DEFINE_TYPE_WITH_CODE (MetaDeviceManagerNative,
                          CLUTTER_TYPE_DEVICE_MANAGER,
                          G_ADD_PRIVATE (MetaDeviceManagerNative))
 
-static void
-meta_device_manager_native_copy_event_data (ClutterDeviceManager *device_manager,
-                                            const ClutterEvent   *src,
-                                            ClutterEvent         *dest)
-{
-  MetaEventNative *event_evdev;
-
-  event_evdev = _clutter_event_get_platform_data (src);
-  if (event_evdev != NULL)
-    _clutter_event_set_platform_data (dest, meta_event_native_copy (event_evdev));
-}
-
-static void
-meta_device_manager_native_free_event_data (ClutterDeviceManager *device_manager,
-                                            ClutterEvent         *event)
-{
-  MetaEventNative *event_evdev;
-
-  event_evdev = _clutter_event_get_platform_data (event);
-  if (event_evdev != NULL)
-    meta_event_native_free (event_evdev);
-}
-
 /*
  * ClutterDeviceManager implementation
  */
@@ -215,8 +192,6 @@ meta_device_manager_native_class_init (MetaDeviceManagerNativeClass *klass)
   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;
-  manager_class->copy_event_data = meta_device_manager_native_copy_event_data;
-  manager_class->free_event_data = meta_device_manager_native_free_event_data;
 }
 
 static void
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index ca4d3ad59..accae8f28 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -2533,6 +2533,29 @@ meta_seat_native_get_keymap (ClutterSeat *seat)
   return CLUTTER_KEYMAP (seat_native->keymap);
 }
 
+static void
+meta_seat_native_copy_event_data (ClutterSeat        *seat,
+                                  const ClutterEvent *src,
+                                  ClutterEvent       *dest)
+{
+  MetaEventNative *event_evdev;
+
+  event_evdev = _clutter_event_get_platform_data (src);
+  if (event_evdev != NULL)
+    _clutter_event_set_platform_data (dest, meta_event_native_copy (event_evdev));
+}
+
+static void
+meta_seat_native_free_event_data (ClutterSeat  *seat,
+                                  ClutterEvent *event)
+{
+  MetaEventNative *event_evdev;
+
+  event_evdev = _clutter_event_get_platform_data (event);
+  if (event_evdev != NULL)
+    meta_event_native_free (event_evdev);
+}
+
 static void
 meta_seat_native_class_init (MetaSeatNativeClass *klass)
 {
@@ -2550,6 +2573,8 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
   seat_class->list_devices = meta_seat_native_list_devices;
   seat_class->bell_notify = meta_seat_native_bell_notify;
   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;
 
   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 946aea5b0..b58fb3a50 100644
--- a/src/backends/x11/meta-device-manager-x11.c
+++ b/src/backends/x11/meta-device-manager-x11.c
@@ -52,29 +52,6 @@ G_DEFINE_TYPE (MetaDeviceManagerX11,
                meta_device_manager_x11,
                CLUTTER_TYPE_DEVICE_MANAGER)
 
-static void
-meta_device_manager_x11_copy_event_data (ClutterDeviceManager *device_manager,
-                                         const ClutterEvent   *src,
-                                         ClutterEvent         *dest)
-{
-  gpointer event_x11;
-
-  event_x11 = _clutter_event_get_platform_data (src);
-  if (event_x11 != NULL)
-    _clutter_event_set_platform_data (dest, meta_event_x11_copy (event_x11));
-}
-
-static void
-meta_device_manager_x11_free_event_data (ClutterDeviceManager *device_manager,
-                                         ClutterEvent         *event)
-{
-  gpointer event_x11;
-
-  event_x11 = _clutter_event_get_platform_data (event);
-  if (event_x11 != NULL)
-    meta_event_x11_free (event_x11);
-}
-
 static void
 meta_device_manager_x11_select_stage_events (ClutterDeviceManager *manager,
                                              ClutterStage         *stage)
@@ -301,8 +278,6 @@ meta_device_manager_x11_class_init (MetaDeviceManagerX11Class *klass)
   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;
-  manager_class->copy_event_data = meta_device_manager_x11_copy_event_data;
-  manager_class->free_event_data = meta_device_manager_x11_free_event_data;
 }
 
 static void
diff --git a/src/backends/x11/meta-seat-x11.c b/src/backends/x11/meta-seat-x11.c
index d7d937f82..995219b81 100644
--- a/src/backends/x11/meta-seat-x11.c
+++ b/src/backends/x11/meta-seat-x11.c
@@ -1456,6 +1456,29 @@ meta_seat_x11_get_keymap (ClutterSeat *seat)
   return CLUTTER_KEYMAP (META_SEAT_X11 (seat)->keymap);
 }
 
+static void
+meta_seat_x11_copy_event_data (ClutterSeat        *seat,
+                               const ClutterEvent *src,
+                               ClutterEvent       *dest)
+{
+  gpointer event_x11;
+
+  event_x11 = _clutter_event_get_platform_data (src);
+  if (event_x11 != NULL)
+    _clutter_event_set_platform_data (dest, meta_event_x11_copy (event_x11));
+}
+
+static void
+meta_seat_x11_free_event_data (ClutterSeat  *seat,
+                               ClutterEvent *event)
+{
+  gpointer event_x11;
+
+  event_x11 = _clutter_event_get_platform_data (event);
+  if (event_x11 != NULL)
+    meta_event_x11_free (event_x11);
+}
+
 static void
 meta_seat_x11_class_init (MetaSeatX11Class *klass)
 {
@@ -1472,6 +1495,8 @@ meta_seat_x11_class_init (MetaSeatX11Class *klass)
   seat_class->list_devices = meta_seat_x11_list_devices;
   seat_class->bell_notify = meta_seat_x11_bell_notify;
   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;
 
   props[PROP_OPCODE] =
     g_param_spec_int ("opcode",


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