input-device: Move select_stage_events() to a vfunc

Don't use a signal, use a virtual function.
This commit is contained in:
Emmanuele Bassi 2011-01-17 17:01:58 +00:00
parent 2777c52f27
commit 342cdd2575
4 changed files with 13 additions and 29 deletions

View File

@ -109,6 +109,10 @@ struct _ClutterInputDevice
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
void (* select_stage_events) (ClutterInputDevice *device,
ClutterStage *stage,
gint event_mask);
};
/* device manager */

View File

@ -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);
}

View File

@ -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

View File

@ -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