Fix delete-event signal handler

Use the right marshaller signature (boolean:boxed) for the delete-event
signal handlers. Add a debug note in clutter_main_do_event() to track the
signal return. Test the delete-event handler inside test.c.
This commit is contained in:
Emmanuele Bassi 2007-04-19 15:27:46 +00:00
parent b2d01d86c2
commit 842dde6ba9
4 changed files with 14 additions and 5 deletions

View File

@ -158,9 +158,13 @@ clutter_main_do_event (ClutterEvent *event,
gboolean res = FALSE; gboolean res = FALSE;
g_object_ref (stage); g_object_ref (stage);
g_signal_emit_by_name (stage, "delete-event", event, &res); g_signal_emit_by_name (stage, "delete-event", event, &res);
CLUTTER_NOTE (EVENT, "delete-event return: %s",
res == TRUE ? "true" : "false");
if (!res) if (!res)
clutter_main_quit (); clutter_main_quit ();
g_object_unref (stage); g_object_unref (stage);
} }
break; break;

View File

@ -6,3 +6,4 @@ VOID:BOXED
VOID:OBJECT VOID:OBJECT
VOID:VOID VOID:VOID
VOID:OBJECT,POINTER VOID:OBJECT,POINTER
BOOLEAN:BOXED

View File

@ -188,7 +188,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
ClutterStageClass *stage_class = CLUTTER_STAGE_CLASS (klass);
gobject_class->set_property = clutter_stage_set_property; gobject_class->set_property = clutter_stage_set_property;
gobject_class->get_property = clutter_stage_get_property; gobject_class->get_property = clutter_stage_get_property;
@ -360,7 +359,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageClass, delete_event), G_STRUCT_OFFSET (ClutterStageClass, delete_event),
_clutter_boolean_accumulator, NULL, _clutter_boolean_accumulator, NULL,
clutter_marshal_VOID__BOXED, clutter_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN, 1,
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);

View File

@ -84,9 +84,14 @@ delete_event_cb (ClutterStage *stage,
ClutterEvent *event, ClutterEvent *event,
gpointer data) gpointer data)
{ {
g_print ("delete-event\n"); static gboolean res = FALSE;
return TRUE; g_print ("delete-event: %s\n",
res == FALSE ? "first attempt" : "second attempt");
res = !res;
return res;
} }