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;
g_object_ref (stage);
g_signal_emit_by_name (stage, "delete-event", event, &res);
CLUTTER_NOTE (EVENT, "delete-event return: %s",
res == TRUE ? "true" : "false");
if (!res)
clutter_main_quit ();
g_object_unref (stage);
}
break;
@ -657,6 +661,6 @@ _clutter_boolean_accumulator (GSignalInvocationHint *ihint,
signal_handled = g_value_get_boolean (handler_return);
g_value_set_boolean (return_accu, signal_handled);
continue_emission = !signal_handled;
return continue_emission;
}

View File

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

View File

@ -188,7 +188,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_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->get_property = clutter_stage_get_property;
@ -360,7 +359,7 @@ clutter_stage_class_init (ClutterStageClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageClass, delete_event),
_clutter_boolean_accumulator, NULL,
clutter_marshal_VOID__BOXED,
clutter_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);

View File

@ -84,9 +84,14 @@ delete_event_cb (ClutterStage *stage,
ClutterEvent *event,
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;
}