2007-10-10 Emmanuele Bassi <ebassi@openedhand.com>

* 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.
This commit is contained in:
Emmanuele Bassi 2007-10-10 14:29:29 +00:00
parent 6216ce659c
commit 717a82303a
6 changed files with 73 additions and 71 deletions

View File

@ -1,3 +1,24 @@
2007-10-10 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <mallum@openedhand.com>
* clutter/clutter-actor.c:

View File

@ -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:
g_object_unref (actor);
return retval;

View File

@ -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

View File

@ -95,6 +95,18 @@
* }
* </programlisting>
*
* Clutter reserves the following names, so classes defining properties
* through the usual GObject registration process should avoid using these
* names to avoid collisions:
*
* <programlisting><![CDATA[
* "id" := the unique name of a ClutterScript object
* "type" := the class literal name, also used to infer the type function
* "type_func" := the GType function name, for non-standard classes
* "children" := an array of names or objects to add as children
* "behaviours" := an array of names or objects to apply to an actor
* ]]></programlisting>
*
* #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:
{
gint value;
if (G_VALUE_HOLDS (src, G_TYPE_STRING))
{
const gchar *string = g_value_get_string (src);
gint flags_value;
if (clutter_script_flags_from_string (gtype, string, &flags_value))
{
g_value_set_flags (dest, flags_value);
retval = TRUE;
}
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))
{
g_value_set_flags (dest, g_value_get_int (src));
retval = TRUE;
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;

View File

@ -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");
}
}

View File

@ -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\""