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
This commit is contained in:
parent
e56df455ae
commit
f54bf022bd
@ -91,12 +91,6 @@ struct _ClutterBackendClass
|
||||
GError **error);
|
||||
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
|
||||
|
||||
void (* copy_event_data) (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest);
|
||||
void (* free_event_data) (ClutterBackend *backend,
|
||||
ClutterEvent *event);
|
||||
|
||||
gboolean (* translate_event) (ClutterBackend *backend,
|
||||
gpointer native,
|
||||
ClutterEvent *event);
|
||||
|
@ -819,37 +819,24 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
|
||||
const ClutterEvent *src,
|
||||
ClutterEvent *dest)
|
||||
{
|
||||
ClutterEventExtenderInterface *iface;
|
||||
ClutterBackendClass *klass;
|
||||
ClutterDeviceManagerClass *device_manager_class;
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
|
||||
{
|
||||
iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
|
||||
iface->copy_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
|
||||
src, dest);
|
||||
}
|
||||
else if (klass->copy_event_data != NULL)
|
||||
klass->copy_event_data (backend, src, dest);
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_backend_free_event_data (ClutterBackend *backend,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterEventExtenderInterface *iface;
|
||||
ClutterBackendClass *klass;
|
||||
ClutterDeviceManagerClass *device_manager_class;
|
||||
ClutterDeviceManager *device_manager;
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
|
||||
if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
|
||||
{
|
||||
iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
|
||||
iface->free_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
|
||||
event);
|
||||
}
|
||||
else if (klass->free_event_data != NULL)
|
||||
klass->free_event_data (backend, event);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user