From 717a82303aaa7187fe4e9d9ae67110800ca37d19 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 10 Oct 2007 14:29:29 +0000 Subject: [PATCH] 2007-10-10 Emmanuele Bassi * clutter/clutter-actor.c: Remove the ::event-after signal: three event layers to connect to seems a bit overkill. (clutter_actor_event): Return FALSE, not TRUE by default, as g_signal_emit() will change the return value if no handlers are connected * clutter/clutter-stage.c: Emit ::notify when we change the fullscreen property. * clutter/clutter-script.c: Add more documentation for the definition format and keywords. (translate_property): Collapse the G_TYPE_ENUM and G_TYPE_FLAGS cases into one, to simplify the code. * tests/test-script.c: Test enumeration conversion by using a value different from the default. --- ChangeLog | 21 ++++++++++++ clutter/clutter-actor.c | 43 ++++++------------------ clutter/clutter-main.c | 2 +- clutter/clutter-script.c | 72 ++++++++++++++++++++-------------------- clutter/clutter-stage.c | 4 +++ tests/test-script.c | 2 +- 6 files changed, 73 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed6e37cd8..a927117fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2007-10-10 Emmanuele Bassi + + * clutter/clutter-actor.c: Remove the ::event-after signal: + three event layers to connect to seems a bit overkill. + + (clutter_actor_event): Return FALSE, not TRUE by default, + as g_signal_emit() will change the return value if no + handlers are connected + + * clutter/clutter-stage.c: Emit ::notify when we change + the fullscreen property. + + * clutter/clutter-script.c: Add more documentation for the + definition format and keywords. + + (translate_property): Collapse the G_TYPE_ENUM and G_TYPE_FLAGS + cases into one, to simplify the code. + + * tests/test-script.c: Test enumeration conversion by using + a value different from the default. + 2007-10-10 Matthew Allum * clutter/clutter-actor.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 0524022b8..1373bb634 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -107,7 +107,6 @@ enum EVENT, EVENT_CAPTURED, - EVENT_AFTER, BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, SCROLL_EVENT, @@ -1270,25 +1269,6 @@ clutter_actor_class_init (ClutterActorClass *klass) clutter_marshal_BOOLEAN__BOXED, G_TYPE_BOOLEAN, 1, CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - /** - * ClutterActor::event-after: - * @actor: the actor which received the event - * @event: a #ClutterEvent - * - * The ::event-after signal is emitted after each event, except for - * the "delete-event" is received by @actor. - * - * Since: 0.6 - */ - actor_signals[EVENT_AFTER] = - g_signal_new ("event-after", - G_TYPE_FROM_CLASS (object_class), - 0, - 0, - NULL, NULL, - clutter_marshal_VOID__BOXED, - G_TYPE_NONE, 1, - CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); /** * ClutterActor::button-press-event: * @actor: the actor which received the event @@ -1457,10 +1437,10 @@ clutter_actor_class_init (ClutterActorClass *klass) G_TYPE_NONE, 0); /** - * ClutterActor::enter: + * ClutterActor::enter-event: * @actor: the actor which the pointer has entered. * - * The ::enter signal is emitted when the pointer enters the @actor + * The ::enter-event signal is emitted when the pointer enters the @actor * * Since: 0.6 */ @@ -1475,10 +1455,10 @@ clutter_actor_class_init (ClutterActorClass *klass) CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); /** - * ClutterActor::leave: + * ClutterActor::leave-event: * @actor: the actor which the pointer has left * - * The ::leave signal is emitted when the pointer leaves the @actor. + * The ::leave-event signal is emitted when the pointer leaves the @actor. * * Since: 0.6 */ @@ -1496,7 +1476,8 @@ clutter_actor_class_init (ClutterActorClass *klass) * ClutterActor::captured-event: * @actor: the actor which the pointer has left * - * The ::leave signal is emitted when the pointer leaves the @actor. + * The ::captured-event signal is emitted when an event is captured + * by Clutter. * * Since: 0.6 */ @@ -3011,7 +2992,7 @@ clutter_actor_event (ClutterActor *actor, ClutterEvent *event, gboolean capture) { - gboolean retval = TRUE; + gboolean retval = FALSE; gint signal_num = -1; g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE); @@ -3022,7 +3003,8 @@ clutter_actor_event (ClutterActor *actor, if (capture) { g_signal_emit (actor, actor_signals[EVENT_CAPTURED], 0, - event, &retval); + event, + &retval); goto out; } @@ -3071,12 +3053,7 @@ clutter_actor_event (ClutterActor *actor, event, &retval); } - - if (!retval) - g_signal_emit (actor, actor_signals[EVENT_AFTER], 0, event); - - out: - +out: g_object_unref (actor); return retval; diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 003da3cb4..58d9eae66 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -1358,7 +1358,7 @@ clutter_get_actor_by_id (guint32 id) g_return_val_if_fail (context != NULL, NULL); g_return_val_if_fail (context->actor_hash != NULL, NULL); - return g_hash_table_lookup (context->actor_hash, (gconstpointer)id); + return g_hash_table_lookup (context->actor_hash, GUINT_TO_POINTER (id)); } void diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c index 786b8a742..9d3c42a7d 100644 --- a/clutter/clutter-script.c +++ b/clutter/clutter-script.c @@ -95,6 +95,18 @@ * } * * + * Clutter reserves the following names, so classes defining properties + * through the usual GObject registration process should avoid using these + * names to avoid collisions: + * + * + * * #ClutterScript is available since Clutter 0.6 */ @@ -794,43 +806,31 @@ translate_property (ClutterScript *script, break; case G_TYPE_ENUM: - /* enumeration values can be expressed using the nick field - * of GEnumValue or the actual integer value - */ - if (G_VALUE_HOLDS (src, G_TYPE_STRING)) - { - const gchar *string = g_value_get_string (src); - gint enum_value; - - if (clutter_script_enum_from_string (gtype, string, &enum_value)) - { - g_value_set_enum (dest, enum_value); - retval = TRUE; - } - } - else if (G_VALUE_HOLDS (src, G_TYPE_INT)) - { - g_value_set_enum (dest, g_value_get_int (src)); - retval = TRUE; - } - break; - case G_TYPE_FLAGS: - if (G_VALUE_HOLDS (src, G_TYPE_STRING)) - { - const gchar *string = g_value_get_string (src); - gint flags_value; + { + gint value; - if (clutter_script_flags_from_string (gtype, string, &flags_value)) - { - g_value_set_flags (dest, flags_value); - retval = TRUE; - } - } - else if (G_VALUE_HOLDS (src, G_TYPE_INT)) - { - g_value_set_flags (dest, g_value_get_int (src)); - retval = TRUE; + if (G_VALUE_HOLDS (src, G_TYPE_STRING)) + { + const gchar *string = g_value_get_string (src); + + if (G_TYPE_FUNDAMENTAL (gtype) == G_TYPE_ENUM) + retval = clutter_script_enum_from_string (gtype, string, &value); + else + retval = clutter_script_flags_from_string (gtype, string, &value); + } + else if (G_VALUE_HOLDS (src, G_TYPE_INT)) + { + value = g_value_get_int (src); + } + + if (retval) + { + if (G_TYPE_FUNDAMENTAL (gtype) == G_TYPE_ENUM) + g_value_set_enum (dest, value); + else + g_value_set_flags (dest, value); + } } break; @@ -1408,7 +1408,7 @@ clutter_script_enum_from_string (GType type, g_type_class_unref (eclass); } - + return retval; } diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index ee36601e9..63682dd0b 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -837,11 +837,15 @@ clutter_stage_event (ClutterStage *stage, { priv->is_fullscreen = TRUE; g_signal_emit (stage, stage_signals[FULLSCREEN], 0); + + g_object_notify (G_OBJECT (stage), "fullscreen"); } else { priv->is_fullscreen = FALSE; g_signal_emit (stage, stage_signals[UNFULLSCREEN], 0); + + g_object_notify (G_OBJECT (stage), "fullscreen"); } } diff --git a/tests/test-script.c b/tests/test-script.c index b3cc51756..1ef5766ed 100644 --- a/tests/test-script.c +++ b/tests/test-script.c @@ -19,7 +19,7 @@ static const gchar *test_behaviour = " \"type\" : \"ClutterBehaviourRotate\"," " \"angle-begin\" : 0.0," " \"angle-end\" : 360.0," -" \"axis\" : \"z-axis\"," +" \"axis\" : \"y-axis\"," " \"alpha\" : {" " \"timeline\" : \"main-timeline\"," " \"function\" : \"sine\""