[clutter] x11: Implement ClutterEventExtender



commit 9215852c32f09cb8effc9ea387fd5383df93607d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 17 19:38:32 2015 +0100

    x11: Implement ClutterEventExtender
    
    This lifts the responsibility off its ClutterBackend.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758238

 clutter/x11/clutter-backend-x11.c        |   25 ---------------------
 clutter/x11/clutter-device-manager-xi2.c |   35 +++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c
index c8a13e7..3f18a76 100644
--- a/clutter/x11/clutter-backend-x11.c
+++ b/clutter/x11/clutter-backend-x11.c
@@ -576,29 +576,6 @@ clutter_backend_x11_get_features (ClutterBackend *backend)
 }
 
 static void
-clutter_backend_x11_copy_event_data (ClutterBackend     *backend,
-                                     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, _clutter_event_x11_copy (event_x11));
-}
-
-static void
-clutter_backend_x11_free_event_data (ClutterBackend *backend,
-                                     ClutterEvent   *event)
-{
-  gpointer event_x11;
-
-  event_x11 = _clutter_event_get_platform_data (event);
-  if (event_x11 != NULL)
-    _clutter_event_x11_free (event_x11);
-}
-
-static void
 update_last_event_time (ClutterBackendX11 *backend_x11,
                         XEvent            *xevent)
 {
@@ -861,8 +838,6 @@ clutter_backend_x11_class_init (ClutterBackendX11Class *klass)
   backend_class->add_options = clutter_backend_x11_add_options;
   backend_class->get_features = clutter_backend_x11_get_features;
 
-  backend_class->copy_event_data = clutter_backend_x11_copy_event_data;
-  backend_class->free_event_data = clutter_backend_x11_free_event_data;
   backend_class->translate_event = clutter_backend_x11_translate_event;
 
   backend_class->get_renderer = clutter_backend_x11_get_renderer;
diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index 7cfcccd..ac513f2 100644
--- a/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/x11/clutter-device-manager-xi2.c
@@ -67,6 +67,7 @@ static const char *clutter_input_axis_atom_names[] = {
 static Atom clutter_input_axis_atoms[N_AXIS_ATOMS] = { 0, };
 
 static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
+static void clutter_event_extender_iface_init   (ClutterEventExtenderInterface *iface);
 
 #define clutter_device_manager_xi2_get_type     _clutter_device_manager_xi2_get_type
 
@@ -74,7 +75,39 @@ G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerXI2,
                          clutter_device_manager_xi2,
                          CLUTTER_TYPE_DEVICE_MANAGER,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_TRANSLATOR,
-                                                clutter_event_translator_iface_init));
+                                                clutter_event_translator_iface_init)
+                         G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_EXTENDER,
+                                                clutter_event_extender_iface_init))
+
+static void
+clutter_device_manager_x11_copy_event_data (ClutterEventExtender *event_extender,
+                                            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, _clutter_event_x11_copy (event_x11));
+}
+
+static void
+clutter_device_manager_x11_free_event_data (ClutterEventExtender *event_extender,
+                                            ClutterEvent         *event)
+{
+  gpointer event_x11;
+
+  event_x11 = _clutter_event_get_platform_data (event);
+  if (event_x11 != NULL)
+    _clutter_event_x11_free (event_x11);
+}
+
+static void
+clutter_event_extender_iface_init (ClutterEventExtenderInterface *iface)
+{
+  iface->copy_event_data = clutter_device_manager_x11_copy_event_data;
+  iface->free_event_data = clutter_device_manager_x11_free_event_data;
+}
 
 static void
 translate_valuator_class (Display             *xdisplay,


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