mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
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;
|
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;
|
||||||
@ -657,6 +661,6 @@ _clutter_boolean_accumulator (GSignalInvocationHint *ihint,
|
|||||||
signal_handled = g_value_get_boolean (handler_return);
|
signal_handled = g_value_get_boolean (handler_return);
|
||||||
g_value_set_boolean (return_accu, signal_handled);
|
g_value_set_boolean (return_accu, signal_handled);
|
||||||
continue_emission = !signal_handled;
|
continue_emission = !signal_handled;
|
||||||
|
|
||||||
return continue_emission;
|
return continue_emission;
|
||||||
}
|
}
|
||||||
|
@ -6,3 +6,4 @@ VOID:BOXED
|
|||||||
VOID:OBJECT
|
VOID:OBJECT
|
||||||
VOID:VOID
|
VOID:VOID
|
||||||
VOID:OBJECT,POINTER
|
VOID:OBJECT,POINTER
|
||||||
|
BOOLEAN:BOXED
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user