From 842dde6ba91d8b813180dd6c91077a7af466fb56 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 19 Apr 2007 15:27:46 +0000 Subject: [PATCH] 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. --- clutter/clutter-main.c | 6 +++++- clutter/clutter-marshal.list | 1 + clutter/clutter-stage.c | 3 +-- examples/test.c | 9 +++++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index d3d9bc148..41977cc30 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -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; } diff --git a/clutter/clutter-marshal.list b/clutter/clutter-marshal.list index 6fb2b54e1..7feb52bae 100644 --- a/clutter/clutter-marshal.list +++ b/clutter/clutter-marshal.list @@ -6,3 +6,4 @@ VOID:BOXED VOID:OBJECT VOID:VOID VOID:OBJECT,POINTER +BOOLEAN:BOXED diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 62e20c5f9..59dcb2b0f 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -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); diff --git a/examples/test.c b/examples/test.c index b3cc6a13d..3cfdf68b8 100644 --- a/examples/test.c +++ b/examples/test.c @@ -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; }