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:
parent
b2d01d86c2
commit
842dde6ba9
@ -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;
|
||||
|
@ -6,3 +6,4 @@ VOID:BOXED
|
||||
VOID:OBJECT
|
||||
VOID:VOID
|
||||
VOID:OBJECT,POINTER
|
||||
BOOLEAN:BOXED
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user