mirror of
https://github.com/brl/mutter.git
synced 2025-02-08 17:44:09 +00:00
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c: Implement part of the ClutterScriptable interface, using the ClutterActor API to set and get the name of an actor. (clutter_geometry_copy), (clutter_geometry_free): Use the slice allocator to avoid fragmentation when setting properties and emitting signals (that is: when packing boxed types into GValues). (clutter_actor_box_copy), (clutter_actor_box_free), (clutter_vertex_copy), (clutter_vertex_free): Ditto. * clutter/clutter-actor.h: * clutter/clutter-actor.c: (clutter_actor_push_transform_child), (clutter_actor_pop_transfomr_child): Simple wrappers around COGL API, which avoid including clutter/cogl.h when writing container actors outside Clutter.
This commit is contained in:
parent
6c01499abf
commit
f0f043cb19
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
|||||||
|
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-actor.c: Implement part of the ClutterScriptable
|
||||||
|
interface, using the ClutterActor API to set and get the name
|
||||||
|
of an actor.
|
||||||
|
|
||||||
|
(clutter_geometry_copy), (clutter_geometry_free): Use
|
||||||
|
the slice allocator to avoid fragmentation when setting
|
||||||
|
properties and emitting signals (that is: when packing
|
||||||
|
boxed types into GValues).
|
||||||
|
|
||||||
|
(clutter_actor_box_copy), (clutter_actor_box_free),
|
||||||
|
(clutter_vertex_copy), (clutter_vertex_free): Ditto.
|
||||||
|
|
||||||
|
* clutter/clutter-actor.h:
|
||||||
|
* clutter/clutter-actor.c:
|
||||||
|
(clutter_actor_push_transform_child),
|
||||||
|
(clutter_actor_pop_transfomr_child): Simple wrappers around
|
||||||
|
COGL API, which avoid including clutter/cogl.h when writing
|
||||||
|
container actors outside Clutter.
|
||||||
|
|
||||||
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
2007-10-25 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/Makefile.am:
|
* clutter/Makefile.am:
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
* phase transversing back up via parents to the stage. An event
|
* phase transversing back up via parents to the stage. An event
|
||||||
* handler can abort this chain at point by returning
|
* handler can abort this chain at point by returning
|
||||||
* %TRUE.</para></listitem>
|
* %TRUE.</para></listitem>
|
||||||
* </orderedlist>
|
* </orderedlist>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -67,15 +67,21 @@
|
|||||||
#include "clutter-container.h"
|
#include "clutter-container.h"
|
||||||
#include "clutter-main.h"
|
#include "clutter-main.h"
|
||||||
#include "clutter-enum-types.h"
|
#include "clutter-enum-types.h"
|
||||||
|
#include "clutter-scriptable.h"
|
||||||
|
#include "clutter-script.h"
|
||||||
#include "clutter-marshal.h"
|
#include "clutter-marshal.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-units.h"
|
#include "clutter-units.h"
|
||||||
#include "cogl.h"
|
#include "cogl.h"
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (ClutterActor,
|
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||||
clutter_actor,
|
|
||||||
G_TYPE_INITIALLY_UNOWNED);
|
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterActor,
|
||||||
|
clutter_actor,
|
||||||
|
G_TYPE_INITIALLY_UNOWNED,
|
||||||
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
||||||
|
clutter_scriptable_iface_init));
|
||||||
|
|
||||||
static guint32 __id = 0;
|
static guint32 __id = 0;
|
||||||
|
|
||||||
@ -141,11 +147,31 @@ enum
|
|||||||
|
|
||||||
static guint actor_signals[LAST_SIGNAL] = { 0, };
|
static guint actor_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
static
|
static void
|
||||||
void _clutter_actor_apply_modelview_transform (ClutterActor * self);
|
clutter_actor_scriptable_set_name (ClutterScriptable *scriptable,
|
||||||
|
const gchar *name)
|
||||||
|
{
|
||||||
|
clutter_actor_set_name (CLUTTER_ACTOR (scriptable), name);
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static const gchar *
|
||||||
void _clutter_actor_apply_modelview_transform_recursive (ClutterActor * self);
|
clutter_actor_scriptable_get_name (ClutterScriptable *scriptable)
|
||||||
|
{
|
||||||
|
return clutter_actor_get_name (CLUTTER_ACTOR (scriptable));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
||||||
|
{
|
||||||
|
iface->set_name = clutter_actor_scriptable_set_name;
|
||||||
|
iface->get_name = clutter_actor_scriptable_get_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_clutter_actor_apply_modelview_transform (ClutterActor * self);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_clutter_actor_apply_modelview_transform_recursive (ClutterActor * self);
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
redraw_update_idle (gpointer data)
|
redraw_update_idle (gpointer data)
|
||||||
@ -3203,20 +3229,69 @@ clutter_actor_is_reactive (ClutterActor *actor)
|
|||||||
return CLUTTER_ACTOR_IS_REACTIVE (actor);
|
return CLUTTER_ACTOR_IS_REACTIVE (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_push_transform_child:
|
||||||
|
*
|
||||||
|
* Makes all the children follow the parent's transformation matrix
|
||||||
|
* until clutter_actor_pop_transform_child().
|
||||||
|
*
|
||||||
|
* This function should be used by every actor with children inside
|
||||||
|
* its paint function, in order to make its children transform (that is:
|
||||||
|
* rotate, scale, etc.) with its parent, like:
|
||||||
|
*
|
||||||
|
* <informalexample><programlisting>
|
||||||
|
* clutter_actor_push_transform_child (<!-- -->);
|
||||||
|
* for (l = my_actor->children; l != NULL; l = l->next)
|
||||||
|
* {
|
||||||
|
* ClutterActor *actor = l->data;
|
||||||
|
* clutter_actor_paint (child);
|
||||||
|
* }
|
||||||
|
* clutter_actor_pop_transform_child (<!-- -->);
|
||||||
|
* </programlisting></informalexample>
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_actor_push_transform_child (void)
|
||||||
|
{
|
||||||
|
cogl_push_matrix ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_pop_transform_child:
|
||||||
|
*
|
||||||
|
* Cancels the effects of a previous clutter_actor_push_transform_child()
|
||||||
|
* call.
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_actor_pop_transform_child (void)
|
||||||
|
{
|
||||||
|
cogl_pop_matrix ();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ClutterGemoetry
|
* ClutterGeometry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static ClutterGeometry*
|
static ClutterGeometry*
|
||||||
clutter_geometry_copy (const ClutterGeometry *geometry)
|
clutter_geometry_copy (const ClutterGeometry *geometry)
|
||||||
{
|
{
|
||||||
ClutterGeometry *result = g_new (ClutterGeometry, 1);
|
ClutterGeometry *result = g_slice_new (ClutterGeometry);
|
||||||
|
|
||||||
*result = *geometry;
|
*result = *geometry;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_geometry_free (ClutterGeometry *geometry)
|
||||||
|
{
|
||||||
|
if (G_LIKELY (geometry))
|
||||||
|
g_slice_free (ClutterGeometry, geometry);
|
||||||
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
clutter_geometry_get_type (void)
|
clutter_geometry_get_type (void)
|
||||||
{
|
{
|
||||||
@ -3226,7 +3301,7 @@ clutter_geometry_get_type (void)
|
|||||||
our_type = g_boxed_type_register_static
|
our_type = g_boxed_type_register_static
|
||||||
(g_intern_static_string ("ClutterGeometry"),
|
(g_intern_static_string ("ClutterGeometry"),
|
||||||
(GBoxedCopyFunc) clutter_geometry_copy,
|
(GBoxedCopyFunc) clutter_geometry_copy,
|
||||||
(GBoxedFreeFunc) g_free);
|
(GBoxedFreeFunc) clutter_geometry_free);
|
||||||
|
|
||||||
return our_type;
|
return our_type;
|
||||||
}
|
}
|
||||||
@ -3238,13 +3313,20 @@ clutter_geometry_get_type (void)
|
|||||||
static ClutterVertex *
|
static ClutterVertex *
|
||||||
clutter_vertex_copy (const ClutterVertex *vertex)
|
clutter_vertex_copy (const ClutterVertex *vertex)
|
||||||
{
|
{
|
||||||
ClutterVertex *result = g_new (ClutterVertex, 1);
|
ClutterVertex *result = g_slice_new (ClutterVertex);
|
||||||
|
|
||||||
*result = *vertex;
|
*result = *vertex;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_vertex_free (ClutterVertex *vertex)
|
||||||
|
{
|
||||||
|
if (G_UNLIKELY (vertex))
|
||||||
|
g_slice_free (ClutterVertex, vertex);
|
||||||
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
clutter_vertex_get_type (void)
|
clutter_vertex_get_type (void)
|
||||||
{
|
{
|
||||||
@ -3254,7 +3336,7 @@ clutter_vertex_get_type (void)
|
|||||||
our_type = g_boxed_type_register_static
|
our_type = g_boxed_type_register_static
|
||||||
(g_intern_static_string ("ClutterVertex"),
|
(g_intern_static_string ("ClutterVertex"),
|
||||||
(GBoxedCopyFunc) clutter_vertex_copy,
|
(GBoxedCopyFunc) clutter_vertex_copy,
|
||||||
(GBoxedFreeFunc) g_free);
|
(GBoxedFreeFunc) clutter_vertex_free);
|
||||||
|
|
||||||
return our_type;
|
return our_type;
|
||||||
}
|
}
|
||||||
@ -3265,13 +3347,20 @@ clutter_vertex_get_type (void)
|
|||||||
static ClutterActorBox *
|
static ClutterActorBox *
|
||||||
clutter_actor_box_copy (const ClutterActorBox *box)
|
clutter_actor_box_copy (const ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterActorBox *result = g_new (ClutterActorBox, 1);
|
ClutterActorBox *result = g_slice_new (ClutterActorBox);
|
||||||
|
|
||||||
*result = *box;
|
*result = *box;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_actor_box_free (ClutterActorBox *box)
|
||||||
|
{
|
||||||
|
if (G_LIKELY (box))
|
||||||
|
g_slice_free (ClutterActorBox, box);
|
||||||
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
clutter_actor_box_get_type (void)
|
clutter_actor_box_get_type (void)
|
||||||
{
|
{
|
||||||
@ -3281,7 +3370,6 @@ clutter_actor_box_get_type (void)
|
|||||||
our_type = g_boxed_type_register_static
|
our_type = g_boxed_type_register_static
|
||||||
(g_intern_static_string ("ClutterActorBox"),
|
(g_intern_static_string ("ClutterActorBox"),
|
||||||
(GBoxedCopyFunc) clutter_actor_box_copy,
|
(GBoxedCopyFunc) clutter_actor_box_copy,
|
||||||
(GBoxedFreeFunc) g_free);
|
(GBoxedFreeFunc) clutter_actor_box_free);
|
||||||
return our_type;
|
return our_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +366,9 @@ void clutter_actor_apply_transform_to_point (ClutterActor
|
|||||||
ClutterVertex *point,
|
ClutterVertex *point,
|
||||||
ClutterVertex *vertex);
|
ClutterVertex *vertex);
|
||||||
|
|
||||||
|
void clutter_actor_push_transform_child (void);
|
||||||
|
void clutter_actor_pop_transform_child (void);
|
||||||
|
|
||||||
/* Per actor event handling - may change */
|
/* Per actor event handling - may change */
|
||||||
gboolean
|
gboolean
|
||||||
clutter_actor_event (ClutterActor *actor,
|
clutter_actor_event (ClutterActor *actor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user