[mutter/wip/carlosg/input-in-backends: 6/18] clutter: Remove ClutterEventExtender interface
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/input-in-backends: 6/18] clutter: Remove ClutterEventExtender interface
- Date: Thu, 4 Jul 2019 13:57:18 +0000 (UTC)
commit 6dcfe0d1b370ac3b2793284edceb93b735b0838d
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Mar 26 19:40:45 2019 +0100
clutter: Remove ClutterEventExtender interface
Just move those methods to ClutterDeviceManager, since the two available
ones want to implement it.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
clutter/clutter/clutter-backend.c | 20 +++++++++----------
clutter/clutter/clutter-device-manager-private.h | 22 ---------------------
clutter/clutter/clutter-device-manager.c | 9 ---------
clutter/clutter/clutter-device-manager.h | 10 +++++++++-
.../clutter/evdev/clutter-device-manager-evdev.c | 19 +++++-------------
clutter/clutter/x11/clutter-device-manager-xi2.c | 23 +++++++---------------
6 files changed, 31 insertions(+), 72 deletions(-)
---
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
index be3902a2f..e2f388743 100644
--- a/clutter/clutter/clutter-backend.c
+++ b/clutter/clutter/clutter-backend.c
@@ -826,15 +826,15 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest)
{
- ClutterEventExtenderInterface *iface;
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
- if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
+ if (backend->device_manager)
{
- iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
- iface->copy_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
- src, dest);
+ ClutterDeviceManagerClass *device_manager_class;
+
+ device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (backend->device_manager);
+ device_manager_class->copy_event_data (backend->device_manager, src, dest);
}
else if (klass->copy_event_data != NULL)
klass->copy_event_data (backend, src, dest);
@@ -844,16 +844,16 @@ void
_clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event)
{
- ClutterEventExtenderInterface *iface;
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
- if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
+ if (backend->device_manager)
{
- iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
- iface->free_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
- event);
+ ClutterDeviceManagerClass *device_manager_class;
+
+ device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (backend->device_manager);
+ device_manager_class->free_event_data (backend->device_manager, event);
}
else if (klass->free_event_data != NULL)
klass->free_event_data (backend, event);
diff --git a/clutter/clutter/clutter-device-manager-private.h
b/clutter/clutter/clutter-device-manager-private.h
index 712dd404a..86355285a 100644
--- a/clutter/clutter/clutter-device-manager-private.h
+++ b/clutter/clutter/clutter-device-manager-private.h
@@ -193,28 +193,6 @@ struct _ClutterInputDeviceClass
ClutterEmitInputDeviceEvent emit_event_func);
};
-/* Platform-dependent interface */
-typedef struct _ClutterEventExtender ClutterEventExtender;
-typedef struct _ClutterEventExtenderInterface ClutterEventExtenderInterface;
-
-#define CLUTTER_TYPE_EVENT_EXTENDER (clutter_event_extender_get_type ())
-#define CLUTTER_EVENT_EXTENDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_EVENT_EXTENDER,
ClutterEventExtender))
-#define CLUTTER_IS_EVENT_EXTENDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_EVENT_EXTENDER))
-#define CLUTTER_EVENT_EXTENDER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o),
CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtenderInterface))
-
-struct _ClutterEventExtenderInterface
-{
- GTypeInterface g_iface;
-
- void (* copy_event_data) (ClutterEventExtender *event_extender,
- const ClutterEvent *src,
- ClutterEvent *dest);
- void (* free_event_data) (ClutterEventExtender *event_extender,
- ClutterEvent *event);
-};
-
-GType clutter_event_extender_get_type (void) G_GNUC_CONST;
-
/* device manager */
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
diff --git a/clutter/clutter/clutter-device-manager.c b/clutter/clutter/clutter-device-manager.c
index 1158f97b9..5c2b3c338 100644
--- a/clutter/clutter/clutter-device-manager.c
+++ b/clutter/clutter/clutter-device-manager.c
@@ -91,15 +91,6 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager,
clutter_device_manager,
G_TYPE_OBJECT)
-G_DEFINE_INTERFACE (ClutterEventExtender,
- clutter_event_extender,
- CLUTTER_TYPE_DEVICE_MANAGER)
-
-static void
-clutter_event_extender_default_init (ClutterEventExtenderInterface *iface)
-{
-}
-
static void
clutter_device_manager_set_property (GObject *gobject,
guint prop_id,
diff --git a/clutter/clutter/clutter-device-manager.h b/clutter/clutter/clutter-device-manager.h
index 2927f1296..f539c7c73 100644
--- a/clutter/clutter/clutter-device-manager.h
+++ b/clutter/clutter/clutter-device-manager.h
@@ -123,8 +123,16 @@ struct _ClutterDeviceManagerClass
/* Keyboard accessbility */
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[6];
+ gpointer _padding[4];
};
CLUTTER_EXPORT
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c
b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index 84b0aad49..14da4a7c9 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -110,14 +110,10 @@ struct _ClutterDeviceManagerEvdevPrivate
GList *free_device_ids;
};
-static void clutter_device_manager_evdev_event_extender_init (ClutterEventExtenderInterface *iface);
-
G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerEvdev,
clutter_device_manager_evdev,
CLUTTER_TYPE_DEVICE_MANAGER,
- G_ADD_PRIVATE (ClutterDeviceManagerEvdev)
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_EXTENDER,
- clutter_device_manager_evdev_event_extender_init))
+ G_ADD_PRIVATE (ClutterDeviceManagerEvdev))
static ClutterOpenDeviceCallback device_open_callback;
static ClutterCloseDeviceCallback device_close_callback;
@@ -148,7 +144,7 @@ static const char *device_type_str[] = {
*/
static void
-clutter_device_manager_evdev_copy_event_data (ClutterEventExtender *event_extender,
+clutter_device_manager_evdev_copy_event_data (ClutterDeviceManager *device_manager,
const ClutterEvent *src,
ClutterEvent *dest)
{
@@ -160,7 +156,7 @@ clutter_device_manager_evdev_copy_event_data (ClutterEventExtender *event_extend
}
static void
-clutter_device_manager_evdev_free_event_data (ClutterEventExtender *event_extender,
+clutter_device_manager_evdev_free_event_data (ClutterDeviceManager *device_manager,
ClutterEvent *event)
{
ClutterEventEvdev *event_evdev;
@@ -170,13 +166,6 @@ clutter_device_manager_evdev_free_event_data (ClutterEventExtender *event_extend
_clutter_event_evdev_free (event_evdev);
}
-static void
-clutter_device_manager_evdev_event_extender_init (ClutterEventExtenderInterface *iface)
-{
- iface->copy_event_data = clutter_device_manager_evdev_copy_event_data;
- iface->free_event_data = clutter_device_manager_evdev_free_event_data;
-}
-
/*
* ClutterEventSource for reading input devices
*/
@@ -2047,6 +2036,8 @@ clutter_device_manager_evdev_class_init (ClutterDeviceManagerEvdevClass *klass)
manager_class->get_supported_virtual_device_types =
clutter_device_manager_evdev_get_supported_virtual_device_types;
manager_class->compress_motion = clutter_device_manager_evdev_compress_motion;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_evdev_apply_kbd_a11y_settings;
+ manager_class->copy_event_data = clutter_device_manager_evdev_copy_event_data;
+ manager_class->free_event_data = clutter_device_manager_evdev_free_event_data;
}
static void
diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c
b/clutter/clutter/x11/clutter-device-manager-xi2.c
index 3a27b69e5..5128a16b2 100644
--- a/clutter/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/clutter/x11/clutter-device-manager-xi2.c
@@ -96,18 +96,14 @@ enum
static Atom clutter_input_axis_atoms[N_AXIS_ATOMS] = { 0, };
-static void clutter_event_extender_iface_init (ClutterEventExtenderInterface *iface);
-
#define clutter_device_manager_xi2_get_type _clutter_device_manager_xi2_get_type
-G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerXI2,
- clutter_device_manager_xi2,
- CLUTTER_TYPE_DEVICE_MANAGER,
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_EXTENDER,
- clutter_event_extender_iface_init))
+G_DEFINE_TYPE (ClutterDeviceManagerXI2,
+ clutter_device_manager_xi2,
+ CLUTTER_TYPE_DEVICE_MANAGER)
static void
-clutter_device_manager_x11_copy_event_data (ClutterEventExtender *event_extender,
+clutter_device_manager_xi2_copy_event_data (ClutterDeviceManager *device_manager,
const ClutterEvent *src,
ClutterEvent *dest)
{
@@ -119,7 +115,7 @@ clutter_device_manager_x11_copy_event_data (ClutterEventExtender *event_extender
}
static void
-clutter_device_manager_x11_free_event_data (ClutterEventExtender *event_extender,
+clutter_device_manager_xi2_free_event_data (ClutterDeviceManager *device_manager,
ClutterEvent *event)
{
gpointer event_x11;
@@ -129,13 +125,6 @@ clutter_device_manager_x11_free_event_data (ClutterEventExtender *event_extender
_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,
ClutterInputDevice *device,
@@ -2220,6 +2209,8 @@ clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass)
manager_class->create_virtual_device = clutter_device_manager_xi2_create_virtual_device;
manager_class->get_supported_virtual_device_types =
clutter_device_manager_xi2_get_supported_virtual_device_types;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings;
+ manager_class->copy_event_data = clutter_device_manager_xi2_copy_event_data;
+ manager_class->free_event_data = clutter_device_manager_xi2_free_event_data;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]