gdk: Implement ClutterEventExtender

This lifts the responsibility off its ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
This commit is contained in:
Carlos Garnacho 2015-11-17 19:44:38 +01:00
parent 9215852c32
commit a9b0715df1
2 changed files with 36 additions and 26 deletions

View File

@ -252,29 +252,6 @@ clutter_backend_gdk_get_features (ClutterBackend *backend)
| CLUTTER_FEATURE_STAGE_CURSOR;
}
static void
clutter_backend_gdk_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest)
{
GdkEvent *gdk_event;
gdk_event = _clutter_event_get_platform_data (src);
if (gdk_event != NULL)
_clutter_event_set_platform_data (dest, gdk_event_copy (gdk_event));
}
static void
clutter_backend_gdk_free_event_data (ClutterBackend *backend,
ClutterEvent *event)
{
GdkEvent *gdk_event;
gdk_event = _clutter_event_get_platform_data (event);
if (gdk_event != NULL)
gdk_event_free (gdk_event);
}
static CoglRenderer *
clutter_backend_gdk_get_renderer (ClutterBackend *backend,
GError **error)
@ -405,8 +382,6 @@ clutter_backend_gdk_class_init (ClutterBackendGdkClass *klass)
backend_class->post_parse = _clutter_backend_gdk_post_parse;
backend_class->get_features = clutter_backend_gdk_get_features;
backend_class->copy_event_data = clutter_backend_gdk_copy_event_data;
backend_class->free_event_data = clutter_backend_gdk_free_event_data;
backend_class->get_renderer = clutter_backend_gdk_get_renderer;
backend_class->get_display = clutter_backend_gdk_get_display;

View File

@ -44,7 +44,12 @@
#define clutter_device_manager_gdk_get_type _clutter_device_manager_gdk_get_type
G_DEFINE_TYPE (ClutterDeviceManagerGdk, clutter_device_manager_gdk, CLUTTER_TYPE_DEVICE_MANAGER)
static void clutter_event_extender_iface_init (ClutterEventExtenderInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerGdk, clutter_device_manager_gdk,
CLUTTER_TYPE_DEVICE_MANAGER,
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_EVENT_EXTENDER,
clutter_event_extender_iface_init))
enum {
PROP_0,
@ -52,6 +57,36 @@ enum {
PROP_LAST
};
static void
clutter_device_manager_gdk_copy_event_data (ClutterEventExtender *event_extender,
const ClutterEvent *src,
ClutterEvent *dest)
{
GdkEvent *gdk_event;
gdk_event = _clutter_event_get_platform_data (src);
if (gdk_event != NULL)
_clutter_event_set_platform_data (dest, gdk_event_copy (gdk_event));
}
static void
clutter_device_manager_gdk_free_event_data (ClutterEventExtender *event_extender,
ClutterEvent *event)
{
GdkEvent *gdk_event;
gdk_event = _clutter_event_get_platform_data (event);
if (gdk_event != NULL)
gdk_event_free (gdk_event);
}
static void
clutter_event_extender_iface_init (ClutterEventExtenderInterface *iface)
{
iface->copy_event_data = clutter_device_manager_gdk_copy_event_data;
iface->free_event_data = clutter_device_manager_gdk_free_event_data;
}
ClutterInputDevice *
_clutter_device_manager_gdk_lookup_device (ClutterDeviceManager *manager,
GdkDevice *device)