examples/basic: Use the event type and not a flag

In order to identify whether the crossing event is an enter or a leave,
we should use the ClutterEventType enumeration, not attach a value to
the signal handler.
This commit is contained in:
Emmanuele Bassi 2012-07-29 13:51:23 +01:00
parent 9f83b64182
commit 3649e5d828

View File

@ -28,10 +28,9 @@ animate_color (ClutterActor *actor,
static gboolean static gboolean
on_crossing (ClutterActor *actor, on_crossing (ClutterActor *actor,
ClutterEvent *event, ClutterEvent *event)
gpointer data)
{ {
gboolean is_enter = GPOINTER_TO_UINT (data); gboolean is_enter = clutter_event_type (event) == CLUTTER_ENTER;
float zpos; float zpos;
if (is_enter) if (is_enter)
@ -128,10 +127,10 @@ main (int argc, char *argv[])
clutter_actor_add_child (vase, flowers[1]); clutter_actor_add_child (vase, flowers[1]);
g_signal_connect (flowers[1], "enter-event", g_signal_connect (flowers[1], "enter-event",
G_CALLBACK (on_crossing), G_CALLBACK (on_crossing),
GUINT_TO_POINTER (TRUE)); NULL);
g_signal_connect (flowers[1], "leave-event", g_signal_connect (flowers[1], "leave-event",
G_CALLBACK (on_crossing), G_CALLBACK (on_crossing),
GUINT_TO_POINTER (FALSE)); NULL);
/* the third one is green */ /* the third one is green */
flowers[2] = clutter_actor_new (); flowers[2] = clutter_actor_new ();