2006-12-12 Emmanuele Bassi <ebassi@openedhand.com>

Rework part of the show/hide machinery.  Allow groups sub-classes
	and composite actors to override show_all/hide_all in order to
	decide which children they wish to show/hide.  This means that
	if an actor overrides the default show/hide virtual methods, it'll
	have to chain up to the parent class show/hide.  While we're at it,
	provide the fully recursive clutter_actor_show_all() and
	clutter_actor_hide_all() methods.

	* clutter/clutter-behaviour-path.c: Add apidoc for the ClutterKnot
	functions; add pathological equality case for clutter_knot_equal().

	* clutter/clutter-event.h:
	* clutter/clutter-feature.h:
	* clutter/clutter-behaviour.c:
	* clutter/clutter-behaviour-scale.c:Fix parameters name so that
	gtk-doc doesn't complain.

	* clutter/clutter-actor.c:
	* clutter/clutter-event.c: Add apidoc

	* clutter/clutter-actor.h:
	* clutter/clutter-actor.c: Add a clutter_actor_show_all() and a
	clutter_actor_hide_all() functions; provide a mechanism for
	groups and composited actors to programmatically select what to
	show/hide when clutter_actor_show_all() and clutter_actor_hide_all()
	are called.  If you are overriding the ClutterActor::show or
	the ClutterActor::hide virtual methods you should chain up with
	the parent class.

	* clutter/clutter-group.c: Override show_all and hide_all and
	recursively show/hide every child inside the group;
	clutter_group_show_all() and clutter_group_hide_all() remain as non
	recursive versions of clutter_actor_show_all() and
	clutter_actor_hide_all() (maybe we should rename them in order
	to avoid name clashes with the bindings).

	* clutter/clutter-stage.c:
	* clutter/clutter-texture.c: Chain up with parent class show
	and hide vfuncs.

	* clutter/clutter-clone-texture.h:
	* clutter/clutter-clone-texture.c: Provide API for changing the
	parent texture of a clone texture actor.

	* examples/behave.c:
	* examples/super-oh.c:
	* examples/test.c: Use clutter_actor_show_all() instead of
	clutter_group_show_all().
This commit is contained in:
Emmanuele Bassi 2006-12-12 20:20:04 +00:00
parent 1d1dc43674
commit 10fbfb1659
24 changed files with 422 additions and 161 deletions

View File

@ -1,3 +1,54 @@
2006-12-12 Emmanuele Bassi <ebassi@openedhand.com>
Rework part of the show/hide machinery. Allow groups sub-classes
and composite actors to override show_all/hide_all in order to
decide which children they wish to show/hide. This means that
if an actor overrides the default show/hide virtual methods, it'll
have to chain up to the parent class show/hide. While we're at it,
provide the fully recursive clutter_actor_show_all() and
clutter_actor_hide_all() methods.
* clutter/clutter-behaviour-path.c: Add apidoc for the ClutterKnot
functions; add pathological equality case for clutter_knot_equal().
* clutter/clutter-event.h:
* clutter/clutter-feature.h:
* clutter/clutter-behaviour.c:
* clutter/clutter-behaviour-scale.c:Fix parameters name so that
gtk-doc doesn't complain.
* clutter/clutter-actor.c:
* clutter/clutter-event.c: Add apidoc
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Add a clutter_actor_show_all() and a
clutter_actor_hide_all() functions; provide a mechanism for
groups and composited actors to programmatically select what to
show/hide when clutter_actor_show_all() and clutter_actor_hide_all()
are called. If you are overriding the ClutterActor::show or
the ClutterActor::hide virtual methods you should chain up with
the parent class.
* clutter/clutter-group.c: Override show_all and hide_all and
recursively show/hide every child inside the group;
clutter_group_show_all() and clutter_group_hide_all() remain as non
recursive versions of clutter_actor_show_all() and
clutter_actor_hide_all() (maybe we should rename them in order
to avoid name clashes with the bindings).
* clutter/clutter-stage.c:
* clutter/clutter-texture.c: Chain up with parent class show
and hide vfuncs.
* clutter/clutter-clone-texture.h:
* clutter/clutter-clone-texture.c: Provide API for changing the
parent texture of a clone texture actor.
* examples/behave.c:
* examples/super-oh.c:
* examples/test.c: Use clutter_actor_show_all() instead of
clutter_group_show_all().
2006-12-08 Matthew Allum <mallum@openedhand.com> 2006-12-08 Matthew Allum <mallum@openedhand.com>
* clutter.doap: * clutter.doap:

View File

@ -114,6 +114,21 @@ redraw_update_idle (gpointer data)
return FALSE; return FALSE;
} }
static void
clutter_actor_real_show (ClutterActor *self)
{
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
{
if (!CLUTTER_ACTOR_IS_REALIZED (self))
clutter_actor_realize (self);
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
}
}
/** /**
* clutter_actor_show * clutter_actor_show
* @self: A #ClutterActor * @self: A #ClutterActor
@ -126,22 +141,8 @@ clutter_actor_show (ClutterActor *self)
{ {
if (!CLUTTER_ACTOR_IS_VISIBLE (self)) if (!CLUTTER_ACTOR_IS_VISIBLE (self))
{ {
ClutterActorClass *klass;
g_object_ref (self); g_object_ref (self);
if (!CLUTTER_ACTOR_IS_REALIZED (self))
clutter_actor_realize(self);
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
klass = CLUTTER_ACTOR_GET_CLASS (self);
if (klass->show)
(klass->show) (self);
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
g_signal_emit (self, actor_signals[SHOW], 0); g_signal_emit (self, actor_signals[SHOW], 0);
g_object_notify (G_OBJECT (self), "visible"); g_object_notify (G_OBJECT (self), "visible");
@ -149,6 +150,37 @@ clutter_actor_show (ClutterActor *self)
} }
} }
/**
* clutter_actor_show_all:
* @self: a #ClutterActor
*
* Recursively show an actor, and any child actor if @self is a
* #ClutterGroup.
*
* Since: 0.2
*/
void
clutter_actor_show_all (ClutterActor *self)
{
ClutterActorClass *klass;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
klass = CLUTTER_ACTOR_GET_CLASS (self);
if (klass->show_all)
klass->show_all (self);
}
void
clutter_actor_real_hide (ClutterActor *self)
{
if (CLUTTER_ACTOR_IS_VISIBLE (self))
{
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
clutter_actor_queue_redraw (self);
}
}
/** /**
* clutter_actor_hide * clutter_actor_hide
* @self: A #ClutterActor * @self: A #ClutterActor
@ -161,18 +193,8 @@ clutter_actor_hide (ClutterActor *self)
{ {
if (CLUTTER_ACTOR_IS_VISIBLE (self)) if (CLUTTER_ACTOR_IS_VISIBLE (self))
{ {
ClutterActorClass *klass;
g_object_ref (self); g_object_ref (self);
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
klass = CLUTTER_ACTOR_GET_CLASS (self);
if (klass->hide)
(klass->hide) (self);
clutter_actor_queue_redraw (self);
g_signal_emit (self, actor_signals[HIDE], 0); g_signal_emit (self, actor_signals[HIDE], 0);
g_object_notify (G_OBJECT (self), "visible"); g_object_notify (G_OBJECT (self), "visible");
@ -180,6 +202,27 @@ clutter_actor_hide (ClutterActor *self)
} }
} }
/**
* clutter_actor_hide_all:
* @self: a #ClutterActor
*
* Recursively hides an actor, and any child actor if @self
* is a #ClutterGroup.
*
* Since: 0.2
*/
void
clutter_actor_hide_all (ClutterActor *self)
{
ClutterActorClass *klass;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
klass = CLUTTER_ACTOR_GET_CLASS (self);
if (klass->hide_all)
klass->hide_all (self);
}
/** /**
* clutter_actor_realize * clutter_actor_realize
* @self: A #ClutterActor * @self: A #ClutterActor
@ -776,18 +819,16 @@ clutter_actor_class_init (ClutterActorClass *klass)
clutter_marshal_VOID__OBJECT, clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR); CLUTTER_TYPE_ACTOR);
klass->show = clutter_actor_real_show;
klass->show_all = clutter_actor_show;
klass->hide = clutter_actor_real_hide;
klass->hide_all = clutter_actor_hide;
} }
static void static void
clutter_actor_init (ClutterActor *self) clutter_actor_init (ClutterActor *self)
{ {
gboolean was_floating;
/* sink the GInitiallyUnowned floating flag */
was_floating = g_object_is_floating (G_OBJECT (self));
if (was_floating)
g_object_force_floating (G_OBJECT (self));
self->priv = CLUTTER_ACTOR_GET_PRIVATE (self); self->priv = CLUTTER_ACTOR_GET_PRIVATE (self);
self->priv->parent_actor = NULL; self->priv->parent_actor = NULL;
@ -1011,7 +1052,7 @@ clutter_actor_set_size (ClutterActor *self,
} }
/* /*
* clutter_actor_get_size * clutter_actor_get_size:
* @self: A #ClutterActor * @self: A #ClutterActor
* @width: Location to store width if non NULL. * @width: Location to store width if non NULL.
* @height: Location to store height if non NULL. * @height: Location to store height if non NULL.
@ -1092,10 +1133,10 @@ clutter_actor_get_abs_position (ClutterActor *self,
} }
/** /**
* clutter_actor_get_abs_size * clutter_actor_get_abs_size:
* @self: A #ClutterActor * @self: A #ClutterActor
* @x: Location to store width if non NULL. * @width: Location to store width if non NULL.
* @y: Location to store height if non NULL. * @height: Location to store height if non NULL.
* *
* Gets the absolute size of an actor taking into account * Gets the absolute size of an actor taking into account
* an scaling factors * an scaling factors
@ -1265,12 +1306,14 @@ clutter_actor_set_scale (ClutterActor *self,
} }
/** /**
* clutter_actor_get_scalex * clutter_actor_get_scalex:
* @self: A #ClutterActor * @self: A #ClutterActor
* @scale_x: FIXME * @scale_x: FIXME
* @scale_y: FIXME * @scale_y: FIXME
* *
* FIXME * FIXME
*
* Since: 0.2
*/ */
void void
clutter_actor_get_scalex (ClutterActor *self, clutter_actor_get_scalex (ClutterActor *self,
@ -1285,12 +1328,14 @@ clutter_actor_get_scalex (ClutterActor *self,
} }
/** /**
* clutter_actor_get_scale * clutter_actor_get_scale:
* @self: A #ClutterActor * @self: A #ClutterActor
* @scale_x: FIXME * @scale_x: FIXME
* @scale_y: FIXME * @scale_y: FIXME
* *
* FIXME * FIXME
*
* Since: 0.2
*/ */
void void
clutter_actor_get_scale (ClutterActor *self, clutter_actor_get_scale (ClutterActor *self,
@ -1417,10 +1462,16 @@ void
clutter_actor_set_depth (ClutterActor *self, clutter_actor_set_depth (ClutterActor *self,
gint depth) gint depth)
{ {
/* Sets Z value. - FIXME: should invert ?*/ ClutterActorPrivate *priv;
self->priv->z = depth;
if (self->priv->parent_actor) g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
/* Sets Z value. - FIXME: should invert ?*/
priv->z = depth;
if (priv->parent_actor)
{ {
/* We need to resort the group stacking order as to /* We need to resort the group stacking order as to
* correctly render alpha values. * correctly render alpha values.
@ -1428,8 +1479,7 @@ clutter_actor_set_depth (ClutterActor *self,
* FIXME: This is sub optimal. maybe queue the the sort * FIXME: This is sub optimal. maybe queue the the sort
* before stacking * before stacking
*/ */
clutter_group_sort_depth_order clutter_group_sort_depth_order (CLUTTER_GROUP (priv->parent_actor));
(CLUTTER_GROUP(self->priv->parent_actor));
} }
} }

View File

@ -55,8 +55,8 @@ G_BEGIN_DECLS
#define CLUTTER_ACTOR_IS_MAPPED(e) ((e)->flags & CLUTTER_ACTOR_MAPPED) #define CLUTTER_ACTOR_IS_MAPPED(e) ((e)->flags & CLUTTER_ACTOR_MAPPED)
#define CLUTTER_ACTOR_IS_REALIZED(e) ((e)->flags & CLUTTER_ACTOR_REALIZED) #define CLUTTER_ACTOR_IS_REALIZED(e) ((e)->flags & CLUTTER_ACTOR_REALIZED)
#define CLUTTER_ACTOR_IS_VISIBLE(e) \ #define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \
(CLUTTER_ACTOR_IS_MAPPED(e) && CLUTTER_ACTOR_IS_REALIZED(e)) CLUTTER_ACTOR_IS_REALIZED (e))
typedef struct _ClutterActor ClutterActor; typedef struct _ClutterActor ClutterActor;
typedef struct _ClutterActorClass ClutterActorClass; typedef struct _ClutterActorClass ClutterActorClass;
@ -108,7 +108,9 @@ struct _ClutterActorClass
GObjectClass parent_class; GObjectClass parent_class;
void (* show) (ClutterActor *actor); void (* show) (ClutterActor *actor);
void (* show_all) (ClutterActor *actor);
void (* hide) (ClutterActor *actor); void (* hide) (ClutterActor *actor);
void (* hide_all) (ClutterActor *actor);
void (* realize) (ClutterActor *actor); void (* realize) (ClutterActor *actor);
void (* unrealize) (ClutterActor *actor); void (* unrealize) (ClutterActor *actor);
void (* paint) (ClutterActor *actor); void (* paint) (ClutterActor *actor);
@ -125,8 +127,6 @@ struct _ClutterActorClass
void (* destroy) (ClutterActor *actor); void (* destroy) (ClutterActor *actor);
/* to go ? */ /* to go ? */
void (* show_all) (ClutterActor *actor);
void (* hide_all) (ClutterActor *actor);
void (* queue_redraw) (ClutterActor *actor); void (* queue_redraw) (ClutterActor *actor);
/* padding for future expansion */ /* padding for future expansion */
@ -140,7 +140,9 @@ struct _ClutterActorClass
GType clutter_actor_get_type (void) G_GNUC_CONST; GType clutter_actor_get_type (void) G_GNUC_CONST;
void clutter_actor_show (ClutterActor *self); void clutter_actor_show (ClutterActor *self);
void clutter_actor_show_all (ClutterActor *self);
void clutter_actor_hide (ClutterActor *self); void clutter_actor_hide (ClutterActor *self);
void clutter_actor_hide_all (ClutterActor *self);
void clutter_actor_realize (ClutterActor *self); void clutter_actor_realize (ClutterActor *self);
void clutter_actor_unrealize (ClutterActor *self); void clutter_actor_unrealize (ClutterActor *self);
void clutter_actor_paint (ClutterActor *self); void clutter_actor_paint (ClutterActor *self);

View File

@ -55,6 +55,16 @@
#include <math.h> #include <math.h>
/**
* clutter_knot_copy:
* @knot: a #ClutterKnot
*
* Makes an allocated copy of a knot.
*
* Return value: the copied knot.
*
* Since: 0.2
*/
ClutterKnot * ClutterKnot *
clutter_knot_copy (const ClutterKnot *knot) clutter_knot_copy (const ClutterKnot *knot)
{ {
@ -67,6 +77,14 @@ clutter_knot_copy (const ClutterKnot *knot)
return copy; return copy;
} }
/**
* clutter_knot_free:
* @knot: a #ClutterKnot
*
* Frees the memory of an allocated knot.
*
* Since: 0.2
*/
void void
clutter_knot_free (ClutterKnot *knot) clutter_knot_free (ClutterKnot *knot)
{ {
@ -76,6 +94,17 @@ clutter_knot_free (ClutterKnot *knot)
} }
} }
/**
* clutter_knot_equal:
* @knot_a: First knot
* @knot_b: Second knot
*
* Compares to knot and checks if the point to the same location.
*
* Return value: %TRUE if the knots point to the same location.
*
* Since: 0.2
*/
gboolean gboolean
clutter_knot_equal (const ClutterKnot *knot_a, clutter_knot_equal (const ClutterKnot *knot_a,
const ClutterKnot *knot_b) const ClutterKnot *knot_b)
@ -83,6 +112,9 @@ clutter_knot_equal (const ClutterKnot *knot_a,
g_return_val_if_fail (knot_a != NULL, FALSE); g_return_val_if_fail (knot_a != NULL, FALSE);
g_return_val_if_fail (knot_b != NULL, FALSE); g_return_val_if_fail (knot_b != NULL, FALSE);
if (knot_a == knot_b)
return TRUE;
return knot_a->x == knot_b->x && knot_a->y == knot_b->y; return knot_a->x == knot_b->x && knot_a->y == knot_b->y;
} }

View File

@ -301,6 +301,7 @@ clutter_behaviour_scale_new (ClutterAlpha *alpha,
* @alpha: a #ClutterAlpha * @alpha: a #ClutterAlpha
* @scale_begin: initial scale factor * @scale_begin: initial scale factor
* @scale_end: final scale factor * @scale_end: final scale factor
* @gravity: FIXME
* *
* A fixed point implementation of clutter_behaviour_scale_new() * A fixed point implementation of clutter_behaviour_scale_new()
* *

View File

@ -376,9 +376,9 @@ clutter_behaviour_set_alpha (ClutterBehaviour *behave,
/** /**
* clutter_behaviour_get_actors: * clutter_behaviour_get_actors:
* @behaviour: a #ClutterBehaviour * @behave: a #ClutterBehaviour
* *
* Retrieves all the actors to which @behaviour applies. * Retrieves all the actors to which @behave applies.
* *
* Return value: a list of actors. You should free the returned list * Return value: a list of actors. You should free the returned list
* with g_slist_free() when finished using it. * with g_slist_free() when finished using it.
@ -386,14 +386,14 @@ clutter_behaviour_set_alpha (ClutterBehaviour *behave,
* Since: 0.2 * Since: 0.2
*/ */
GSList * GSList *
clutter_behaviour_get_actors (ClutterBehaviour *behaviour) clutter_behaviour_get_actors (ClutterBehaviour *behave)
{ {
GSList *retval, *l; GSList *retval, *l;
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behaviour), NULL); g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
retval = NULL; retval = NULL;
for (l = behaviour->priv->actors; l != NULL; l = l->next) for (l = behave->priv->actors; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data); retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval); return g_slist_reverse (retval);

View File

@ -35,6 +35,7 @@
#include "clutter-clone-texture.h" #include "clutter-clone-texture.h"
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-feature.h" #include "clutter-feature.h"
#include "clutter-actor.h"
#include "clutter-util.h" #include "clutter-util.h"
#include "clutter-enum-types.h" #include "clutter-enum-types.h"
#include "clutter-private.h" #include "clutter-private.h"
@ -180,6 +181,9 @@ clutter_clone_texture_paint (ClutterActor *self)
priv = CLUTTER_CLONE_TEXTURE (self)->priv; priv = CLUTTER_CLONE_TEXTURE (self)->priv;
/* no need to paint stuff if we don't have a texture to clone */
if (!priv->parent_texture)
return;
/* parent texture may have been hidden, there for need to make sure its /* parent texture may have been hidden, there for need to make sure its
* realised with resources available. * realised with resources available.
@ -190,8 +194,8 @@ clutter_clone_texture_paint (ClutterActor *self)
/* FIXME: figure out nicer way of getting at this info... /* FIXME: figure out nicer way of getting at this info...
*/ */
if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE) if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE) &&
&& clutter_texture_is_tiled (CLUTTER_TEXTURE(parent_texture)) == FALSE) clutter_texture_is_tiled (CLUTTER_TEXTURE (parent_texture)) == FALSE)
target_type = GL_TEXTURE_RECTANGLE_ARB; target_type = GL_TEXTURE_RECTANGLE_ARB;
else else
target_type = GL_TEXTURE_2D; target_type = GL_TEXTURE_2D;
@ -221,6 +225,7 @@ set_parent_texture (ClutterCloneTexture *ctexture,
ClutterTexture *texture) ClutterTexture *texture)
{ {
ClutterCloneTexturePrivate *priv = ctexture->priv; ClutterCloneTexturePrivate *priv = ctexture->priv;
ClutterActor *actor = CLUTTER_ACTOR (ctexture);
if (priv->parent_texture) if (priv->parent_texture)
{ {
@ -228,16 +233,22 @@ set_parent_texture (ClutterCloneTexture *ctexture,
priv->parent_texture = NULL; priv->parent_texture = NULL;
} }
clutter_actor_hide (actor);
if (texture) if (texture)
{ {
gint width, height; gint width, height;
priv->parent_texture = g_object_ref (texture); priv->parent_texture = g_object_ref (texture);
/* Sync up the size to parent texture base pixbuf size. /* Sync up the size to parent texture base pixbuf size. */
*/
clutter_texture_get_base_size (texture, &width, &height); clutter_texture_get_base_size (texture, &width, &height);
clutter_actor_set_size (CLUTTER_ACTOR(ctexture), width, height); clutter_actor_set_size (actor, width, height);
/* queue a redraw if the cloned texture is already visible */
if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (priv->parent_texture)) &&
CLUTTER_ACTOR_IS_VISIBLE (actor))
clutter_actor_queue_redraw (actor);
} }
} }
@ -319,7 +330,7 @@ clutter_clone_texture_class_init (ClutterCloneTextureClass *klass)
"Parent Texture", "Parent Texture",
"The parent texture to clone", "The parent texture to clone",
CLUTTER_TYPE_TEXTURE, CLUTTER_TYPE_TEXTURE,
(G_PARAM_CONSTRUCT_ONLY | CLUTTER_PARAM_READWRITE))); (G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE)));
g_type_class_add_private (gobject_class, sizeof (ClutterCloneTexturePrivate)); g_type_class_add_private (gobject_class, sizeof (ClutterCloneTexturePrivate));
} }
@ -335,19 +346,64 @@ clutter_clone_texture_init (ClutterCloneTexture *self)
/** /**
* clutter_clone_texture_new: * clutter_clone_texture_new:
* @texture: a #ClutterTexture * @texture: a #ClutterTexture or %NULL
* *
* Creates an efficient 'clone' of a pre-existing texture if which it * Creates an efficient 'clone' of a pre-existing texture if which it
* shares the underlying pixbuf data. * shares the underlying pixbuf data.
* *
* You can use clutter_clone_texture_set_parent_texture() to change the
* parent texture to be cloned.
*
* Return value: the newly created #ClutterCloneTexture * Return value: the newly created #ClutterCloneTexture
*/ */
ClutterActor * ClutterActor *
clutter_clone_texture_new (ClutterTexture *texture) clutter_clone_texture_new (ClutterTexture *texture)
{ {
g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), NULL); g_return_val_if_fail (texture == NULL || CLUTTER_IS_TEXTURE (texture), NULL);
return g_object_new (CLUTTER_TYPE_CLONE_TEXTURE, return g_object_new (CLUTTER_TYPE_CLONE_TEXTURE,
"parent-texture", texture, "parent-texture", texture,
NULL); NULL);
} }
/**
* clutter_clone_texture_get_parent_texture:
* @clone: a #ClutterCloneTexture
*
* Retrieves the parent #ClutterTexture used by @clone.
*
* Return value: a #ClutterTexture actor, or %NULL
*
* Since: 0.2
*/
ClutterTexture *
clutter_clone_texture_get_parent_texture (ClutterCloneTexture *clone)
{
g_return_val_if_fail (CLUTTER_IS_CLONE_TEXTURE (clone), NULL);
return clone->priv->parent_texture;
}
/**
* clutter_clone_texture_set_parent_texture:
* @clone: a #ClutterCloneTexture
* @texture a #ClutterTexture or %NULL
*
* Sets the parent texture cloned by the #ClutterCloneTexture.
*
* Since: 0.2
*/
void
clutter_clone_texture_set_parent_texture (ClutterCloneTexture *clone,
ClutterTexture *texture)
{
g_return_if_fail (CLUTTER_IS_CLONE_TEXTURE (clone));
g_return_if_fail (texture == NULL || CLUTTER_IS_TEXTURE (texture));
g_object_ref (clone);
set_parent_texture (clone, texture);
g_object_notify (G_OBJECT (clone), "parent-texture");
g_object_unref (clone);
}

View File

@ -26,8 +26,7 @@
#ifndef _HAVE_CLUTTER_CLONE_TEXTURE_H #ifndef _HAVE_CLUTTER_CLONE_TEXTURE_H
#define _HAVE_CLUTTER_CLONE_TEXTURE_H #define _HAVE_CLUTTER_CLONE_TEXTURE_H
#include <glib-object.h> #include <clutter/clutter-actor.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <clutter/clutter-texture.h> #include <clutter/clutter-texture.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -77,8 +76,12 @@ struct _ClutterCloneTextureClass
void (*_clutter_clone_4) (void); void (*_clutter_clone_4) (void);
}; };
GType clutter_clone_texture_get_type (void); GType clutter_clone_texture_get_type (void) G_GNUC_CONST;
ClutterActor * clutter_clone_texture_new (ClutterTexture *texture); ClutterActor * clutter_clone_texture_new (ClutterTexture *texture);
ClutterTexture *clutter_clone_texture_get_parent_texture (ClutterCloneTexture *clone);
void clutter_clone_texture_set_parent_texture (ClutterCloneTexture *clone,
ClutterTexture *texture);
G_END_DECLS G_END_DECLS

View File

@ -23,29 +23,65 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-event.h" #include "clutter-event.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
/**
* clutter_event_type:
* @event: a #ClutterEvent
*
* Retrieves the type of the event.
*
* Return value: a #ClutterEventType
*/
ClutterEventType ClutterEventType
clutter_event_type (ClutterEvent *event) clutter_event_type (ClutterEvent *event)
{ {
return event->type; return event->type;
} }
/**
* clutter_button_event_time:
* @buttev: a #ClutterButtonEvent
*
* Retrieves the time of the event.
*
* Return value: the time of the event.
*/
guint32 guint32
clutter_button_event_time (ClutterButtonEvent *buttev) clutter_button_event_time (ClutterButtonEvent *buttev)
{ {
return buttev->time; return buttev->time;
} }
/**
* clutter_button_event_x:
* @buttev: a #ClutterButtonEvent
*
* Retrieve the x coordinate of the event.
*
* Return value: the x coordinate.
*/
gint gint
clutter_button_event_x (ClutterButtonEvent *buttev) clutter_button_event_x (ClutterButtonEvent *buttev)
{ {
return buttev->x; return buttev->x;
} }
/**
* clutter_button_event_y:
* @buttev: a #ClutterButtonEvent
*
* Retrieve the y coordinate of the event.
*
* Return value: the y coordinate
*/
gint gint
clutter_button_event_y (ClutterButtonEvent *buttev) clutter_button_event_y (ClutterButtonEvent *buttev)
{ {

View File

@ -116,23 +116,18 @@ GType clutter_event_get_type (void) G_GNUC_CONST;
ClutterEvent *clutter_event_new (ClutterEventType type); ClutterEvent *clutter_event_new (ClutterEventType type);
ClutterEvent *clutter_event_copy (ClutterEvent *event); ClutterEvent *clutter_event_copy (ClutterEvent *event);
void clutter_event_free (ClutterEvent *event); void clutter_event_free (ClutterEvent *event);
ClutterEventType clutter_event_type (ClutterEvent *keyev);
ClutterEventType clutter_key_event_type (ClutterKeyEvent *keyev);
guint32 clutter_key_event_time (ClutterKeyEvent *keyev); guint32 clutter_key_event_time (ClutterKeyEvent *keyev);
guint clutter_key_event_state (ClutterKeyEvent *keyev); guint clutter_key_event_state (ClutterKeyEvent *keyev);
gint clutter_button_event_x (ClutterButtonEvent *buttev);
gint clutter_button_event_y (ClutterButtonEvent *buttev);
guint clutter_key_event_symbol (ClutterKeyEvent *keyev); guint clutter_key_event_symbol (ClutterKeyEvent *keyev);
guint16 clutter_key_event_code (ClutterKeyEvent *keyev); guint16 clutter_key_event_code (ClutterKeyEvent *keyev);
guint32 clutter_key_event_unicode (ClutterKeyEvent *keyev); guint32 clutter_key_event_unicode (ClutterKeyEvent *keyev);
guint32 clutter_button_event_time (ClutterButtonEvent *buttev);
gint clutter_button_event_x (ClutterButtonEvent *buttev);
gint clutter_button_event_y (ClutterButtonEvent *buttev);
guint32 clutter_keysym_to_unicode (guint keyval); guint32 clutter_keysym_to_unicode (guint keyval);
G_END_DECLS G_END_DECLS

View File

@ -37,7 +37,7 @@
#include <GL/glx.h> #include <GL/glx.h>
#include <GL/gl.h> #include <GL/gl.h>
G_END_DECLS G_BEGIN_DECLS
typedef enum typedef enum
{ {
@ -45,7 +45,7 @@ typedef enum
CLUTTER_FEATURE_SYNC_TO_VBLANK = (1 << 2) CLUTTER_FEATURE_SYNC_TO_VBLANK = (1 << 2)
} ClutterFeatureFlags; } ClutterFeatureFlags;
gboolean clutter_feature_available (ClutterFeatureFlags flags); gboolean clutter_feature_available (ClutterFeatureFlags feature);
ClutterFeatureFlags clutter_feature_get_all (void); ClutterFeatureFlags clutter_feature_get_all (void);
void clutter_feature_wait_for_vblank (void); void clutter_feature_wait_for_vblank (void);

View File

@ -158,6 +158,24 @@ clutter_group_finalize (GObject *object)
G_OBJECT_CLASS (clutter_group_parent_class)->finalize (object); G_OBJECT_CLASS (clutter_group_parent_class)->finalize (object);
} }
static void
clutter_group_real_show_all (ClutterActor *actor)
{
clutter_group_foreach (CLUTTER_GROUP (actor),
CLUTTER_CALLBACK (clutter_actor_show_all),
NULL);
clutter_actor_show (actor);
}
static void
clutter_group_real_hide_all (ClutterActor *actor)
{
clutter_actor_hide (actor);
clutter_group_foreach (CLUTTER_GROUP (actor),
CLUTTER_CALLBACK (clutter_actor_hide_all),
NULL);
}
static void static void
clutter_group_class_init (ClutterGroupClass *klass) clutter_group_class_init (ClutterGroupClass *klass)
{ {
@ -165,10 +183,8 @@ clutter_group_class_init (ClutterGroupClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
actor_class->paint = clutter_group_paint; actor_class->paint = clutter_group_paint;
/* actor_class->show_all = clutter_group_real_show_all;
actor_class->show = clutter_group_show_all; actor_class->hide_all = clutter_group_real_hide_all;
actor_class->hide = clutter_group_hide_all;
*/
actor_class->request_coords = clutter_group_request_coords; actor_class->request_coords = clutter_group_request_coords;
actor_class->allocate_coords = clutter_group_allocate_coords; actor_class->allocate_coords = clutter_group_allocate_coords;
@ -272,8 +288,10 @@ clutter_group_foreach (ClutterGroup *self,
* clutter_group_show_all: * clutter_group_show_all:
* @self: A #ClutterGroup * @self: A #ClutterGroup
* *
* Show all child actors of the group. Note, does not recurse. * Show all child actors of the group.
**/ * Note, does not recurse: use clutter_actor_show_all() for
* a recursive show.
*/
void void
clutter_group_show_all (ClutterGroup *self) clutter_group_show_all (ClutterGroup *self)
{ {
@ -290,8 +308,10 @@ clutter_group_show_all (ClutterGroup *self)
* clutter_group_hide_all: * clutter_group_hide_all:
* @self: A #ClutterGroup * @self: A #ClutterGroup
* *
* Hide all child actors of the group. Note, does not recurse. * Hide all child actors of the group.
**/ * Note, does not recurse: use clutter_actor_hide_all() for
* a recursive hide.
*/
void void
clutter_group_hide_all (ClutterGroup *self) clutter_group_hide_all (ClutterGroup *self)
{ {

View File

@ -238,6 +238,12 @@ sync_gl_viewport (ClutterStage *stage)
static void static void
clutter_stage_show (ClutterActor *self) clutter_stage_show (ClutterActor *self)
{ {
ClutterActorClass *parent_class;
parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
if (parent_class->show)
parent_class->show (self);
if (clutter_stage_get_xwindow (CLUTTER_STAGE (self))) if (clutter_stage_get_xwindow (CLUTTER_STAGE (self)))
XMapWindow (clutter_xdisplay (), XMapWindow (clutter_xdisplay (),
clutter_stage_get_xwindow (CLUTTER_STAGE (self))); clutter_stage_get_xwindow (CLUTTER_STAGE (self)));
@ -246,6 +252,12 @@ clutter_stage_show (ClutterActor *self)
static void static void
clutter_stage_hide (ClutterActor *self) clutter_stage_hide (ClutterActor *self)
{ {
ClutterActorClass *parent_class;
parent_class = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
if (parent_class->hide)
parent_class->hide (self);
if (clutter_stage_get_xwindow (CLUTTER_STAGE (self))) if (clutter_stage_get_xwindow (CLUTTER_STAGE (self)))
XUnmapWindow (clutter_xdisplay (), XUnmapWindow (clutter_xdisplay (),
clutter_stage_get_xwindow (CLUTTER_STAGE (self))); clutter_stage_get_xwindow (CLUTTER_STAGE (self)));

View File

@ -639,12 +639,26 @@ clutter_texture_realize (ClutterActor *actor)
static void static void
clutter_texture_show (ClutterActor *self) clutter_texture_show (ClutterActor *self)
{ {
ClutterActorClass *parent_class;
/* chain up parent show */
parent_class = CLUTTER_ACTOR_CLASS (clutter_texture_parent_class);
if (parent_class->show)
parent_class->show (self);
clutter_actor_realize (self); clutter_actor_realize (self);
} }
static void static void
clutter_texture_hide (ClutterActor *self) clutter_texture_hide (ClutterActor *self)
{ {
ClutterActorClass *parent_class;
/* chain up parent hide */
parent_class = CLUTTER_ACTOR_CLASS (clutter_texture_parent_class);
if (parent_class->hide)
parent_class->hide (self);
clutter_actor_unrealize (self); clutter_actor_unrealize (self);
} }

View File

@ -26,9 +26,8 @@
#ifndef _HAVE_CLUTTER_TEXTURE_H #ifndef _HAVE_CLUTTER_TEXTURE_H
#define _HAVE_CLUTTER_TEXTURE_H #define _HAVE_CLUTTER_TEXTURE_H
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <clutter/clutter-actor.h> #include <clutter/clutter-actor.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -58,6 +57,14 @@ struct _ClutterTextureClass
gint width, gint width,
gint height); gint height);
void (*pixbuf_change) (ClutterTexture *texture); void (*pixbuf_change) (ClutterTexture *texture);
/* padding, for future expansion */
void (*_clutter_texture1) (void);
void (*_clutter_texture2) (void);
void (*_clutter_texture3) (void);
void (*_clutter_texture4) (void);
void (*_clutter_texture5) (void);
void (*_clutter_texture6) (void);
}; };
GType clutter_texture_get_type (void) G_GNUC_CONST; GType clutter_texture_get_type (void) G_GNUC_CONST;

View File

@ -463,7 +463,6 @@ CLUTTER_FIXED_DIV
<FILE>clutter-color</FILE> <FILE>clutter-color</FILE>
CLUTTER_TYPE_COLOR CLUTTER_TYPE_COLOR
ClutterColor ClutterColor
clutter_color_get_type
clutter_color_parse clutter_color_parse
clutter_color_add clutter_color_add
clutter_color_subtract clutter_color_subtract
@ -474,6 +473,8 @@ clutter_color_to_hls
clutter_color_from_hls clutter_color_from_hls
clutter_color_to_pixel clutter_color_to_pixel
clutter_color_from_pixel clutter_color_from_pixel
<SUBSECTION Private>
clutter_color_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
@ -486,7 +487,6 @@ ClutterButtonEvent
ClutterMotionEvent ClutterMotionEvent
ClutterInputDevice ClutterInputDevice
ClutterEvent ClutterEvent
clutter_event_get_type
clutter_event_new clutter_event_new
clutter_event_copy clutter_event_copy
clutter_event_free clutter_event_free
@ -499,6 +499,8 @@ clutter_key_event_symbol
clutter_key_event_code clutter_key_event_code
clutter_key_event_unicode clutter_key_event_unicode
clutter_keysym_to_unicode clutter_keysym_to_unicode
<SUBSECTION Private>
clutter_event_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -207,7 +207,9 @@ ClutterActor
@parent_class: @parent_class:
@show: @show:
@show_all:
@hide: @hide:
@hide_all:
@realize: @realize:
@unrealize: @unrealize:
@paint: @paint:
@ -217,8 +219,6 @@ ClutterActor
@get_depth: @get_depth:
@parent_set: @parent_set:
@destroy: @destroy:
@show_all:
@hide_all:
@queue_redraw: @queue_redraw:
@_clutter_actor_1: @_clutter_actor_1:
@_clutter_actor_2: @_clutter_actor_2:

View File

@ -34,14 +34,6 @@ clutter-color
@blue: @blue:
@alpha: @alpha:
<!-- ##### FUNCTION clutter_color_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION clutter_color_parse ##### --> <!-- ##### FUNCTION clutter_color_parse ##### -->
<para> <para>

View File

@ -94,14 +94,6 @@ Windowing events handled by Clutter.
</para> </para>
<!-- ##### FUNCTION clutter_event_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION clutter_event_new ##### --> <!-- ##### FUNCTION clutter_event_new ##### -->
<para> <para>
@ -128,15 +120,6 @@ Windowing events handled by Clutter.
@event: @event:
<!-- ##### FUNCTION clutter_key_event_type ##### -->
<para>
</para>
@keyev:
@Returns:
<!-- ##### FUNCTION clutter_key_event_time ##### --> <!-- ##### FUNCTION clutter_key_event_time ##### -->
<para> <para>

View File

@ -30,7 +30,7 @@ clutter-feature
</para> </para>
@flags: @feature:
@Returns: @Returns:

View File

@ -92,6 +92,12 @@ ClutterTexture
@parent_class: @parent_class:
@size_change: @size_change:
@pixbuf_change: @pixbuf_change:
@_clutter_texture1:
@_clutter_texture2:
@_clutter_texture3:
@_clutter_texture4:
@_clutter_texture5:
@_clutter_texture6:
<!-- ##### FUNCTION clutter_texture_new_from_pixbuf ##### --> <!-- ##### FUNCTION clutter_texture_new_from_pixbuf ##### -->
<para> <para>

View File

@ -77,7 +77,7 @@ main (int argc, char *argv[])
/* start the timeline and thus the animations */ /* start the timeline and thus the animations */
clutter_timeline_start (timeline); clutter_timeline_start (timeline);
clutter_group_show_all (CLUTTER_GROUP (stage)); clutter_actor_show_all (stage);
clutter_main(); clutter_main();

View File

@ -242,8 +242,7 @@ main (int argc, char *argv[])
clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR(oh->group)); clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR(oh->group));
/* Show everying ( and map window ) */ /* Show everying ( and map window ) */
clutter_group_show_all (CLUTTER_GROUP (oh->group)); clutter_actor_show_all (stage);
clutter_group_show_all (CLUTTER_GROUP (stage));
g_signal_connect (stage, "button-press-event", g_signal_connect (stage, "button-press-event",
G_CALLBACK (input_cb), G_CALLBACK (input_cb),

View File

@ -108,7 +108,7 @@ main (int argc, char *argv[])
clutter_actor_set_size (CLUTTER_ACTOR (stage), 800, 600); clutter_actor_set_size (CLUTTER_ACTOR (stage), 800, 600);
clutter_group_show_all (CLUTTER_GROUP (stage)); clutter_actor_show_all (CLUTTER_ACTOR (stage));
timeline = clutter_timeline_new (360, 200); timeline = clutter_timeline_new (360, 200);
g_object_set (timeline, "loop", TRUE, 0); g_object_set (timeline, "loop", TRUE, 0);