From 342cdd25756b37745bfd1725d78f6f670f77bee0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 17 Jan 2011 17:01:58 +0000 Subject: [PATCH] input-device: Move select_stage_events() to a vfunc Don't use a signal, use a virtual function. --- clutter/clutter-device-manager-private.h | 4 +++ clutter/clutter-input-device.c | 28 ++++----------------- clutter/x11/clutter-input-device-core-x11.c | 5 ++-- clutter/x11/clutter-input-device-xi2.c | 5 ++-- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/clutter/clutter-device-manager-private.h b/clutter/clutter-device-manager-private.h index 56dfc5a37..ec5a2fc7f 100644 --- a/clutter/clutter-device-manager-private.h +++ b/clutter/clutter-device-manager-private.h @@ -109,6 +109,10 @@ struct _ClutterInputDevice struct _ClutterInputDeviceClass { GObjectClass parent_class; + + void (* select_stage_events) (ClutterInputDevice *device, + ClutterStage *stage, + gint event_mask); }; /* device manager */ diff --git a/clutter/clutter-input-device.c b/clutter/clutter-input-device.c index 415efcf89..0d2b81f7d 100644 --- a/clutter/clutter-input-device.c +++ b/clutter/clutter-input-device.c @@ -65,17 +65,8 @@ enum PROP_LAST }; -enum -{ - SELECT_STAGE_EVENTS, - - LAST_SIGNAL -}; - static GParamSpec *obj_props[PROP_LAST] = { NULL, }; -static guint device_signals[LAST_SIGNAL] = { 0, }; - G_DEFINE_TYPE (ClutterInputDevice, clutter_input_device, G_TYPE_OBJECT); static void @@ -298,17 +289,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass) gobject_class->set_property = clutter_input_device_set_property; gobject_class->get_property = clutter_input_device_get_property; g_object_class_install_properties (gobject_class, PROP_LAST, obj_props); - - device_signals[SELECT_STAGE_EVENTS] = - g_signal_new (I_("select-stage-events"), - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - 0, - NULL, NULL, - _clutter_marshal_VOID__OBJECT_INT, - G_TYPE_NONE, 2, - CLUTTER_TYPE_STAGE, - G_TYPE_INT); } static void @@ -1100,7 +1080,9 @@ _clutter_input_device_select_stage_events (ClutterInputDevice *device, ClutterStage *stage, gint event_mask) { - g_signal_emit (device, device_signals[SELECT_STAGE_EVENTS], 0, - stage, - event_mask); + ClutterInputDeviceClass *device_class; + + device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device); + if (device_class->select_stage_events != NULL) + device_class->select_stage_events (device, stage, event_mask); } diff --git a/clutter/x11/clutter-input-device-core-x11.c b/clutter/x11/clutter-input-device-core-x11.c index 4c1bf2fa8..5d729e992 100644 --- a/clutter/x11/clutter-input-device-core-x11.c +++ b/clutter/x11/clutter-input-device-core-x11.c @@ -178,13 +178,12 @@ static void clutter_input_device_x11_class_init (ClutterInputDeviceX11Class *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass); gobject_class->constructed = clutter_input_device_x11_constructed; gobject_class->dispose = clutter_input_device_x11_dispose; - g_signal_override_class_handler ("select-stage-events", - CLUTTER_TYPE_INPUT_DEVICE_X11, - G_CALLBACK (clutter_input_device_x11_select_stage_events)); + device_class->select_stage_events = clutter_input_device_x11_select_stage_events; } static void diff --git a/clutter/x11/clutter-input-device-xi2.c b/clutter/x11/clutter-input-device-xi2.c index ac90b25f0..45d5321a9 100644 --- a/clutter/x11/clutter-input-device-xi2.c +++ b/clutter/x11/clutter-input-device-xi2.c @@ -96,12 +96,11 @@ static void clutter_input_device_xi2_class_init (ClutterInputDeviceXI2Class *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_CLASS (klass); gobject_class->constructed = clutter_input_device_xi2_constructed; - g_signal_override_class_handler ("select-stage-events", - CLUTTER_TYPE_INPUT_DEVICE_XI2, - G_CALLBACK (clutter_input_device_xi2_select_stage_events)); + device_class->select_stage_events = clutter_input_device_xi2_select_stage_events; } static void