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>
* clutter.doap:

View File

@ -114,6 +114,21 @@ redraw_update_idle (gpointer data)
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
* @self: A #ClutterActor
@ -126,22 +141,8 @@ clutter_actor_show (ClutterActor *self)
{
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
{
ClutterActorClass *klass;
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_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
* @self: A #ClutterActor
@ -161,18 +193,8 @@ clutter_actor_hide (ClutterActor *self)
{
if (CLUTTER_ACTOR_IS_VISIBLE (self))
{
ClutterActorClass *klass;
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_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
* @self: A #ClutterActor
@ -776,18 +819,16 @@ clutter_actor_class_init (ClutterActorClass *klass)
clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
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
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->parent_actor = NULL;
@ -1011,7 +1052,7 @@ clutter_actor_set_size (ClutterActor *self,
}
/*
* clutter_actor_get_size
* clutter_actor_get_size:
* @self: A #ClutterActor
* @width: Location to store width 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
* @x: Location to store width if non NULL.
* @y: Location to store height if non NULL.
* @width: Location to store width if non NULL.
* @height: Location to store height if non NULL.
*
* Gets the absolute size of an actor taking into account
* an scaling factors
@ -1265,12 +1306,14 @@ clutter_actor_set_scale (ClutterActor *self,
}
/**
* clutter_actor_get_scalex
* clutter_actor_get_scalex:
* @self: A #ClutterActor
* @scale_x: FIXME
* @scale_y: FIXME
*
* FIXME
*
* Since: 0.2
*/
void
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
* @scale_x: FIXME
* @scale_y: FIXME
*
* FIXME
*
* Since: 0.2
*/
void
clutter_actor_get_scale (ClutterActor *self,
@ -1417,10 +1462,16 @@ void
clutter_actor_set_depth (ClutterActor *self,
gint depth)
{
/* Sets Z value. - FIXME: should invert ?*/
self->priv->z = depth;
ClutterActorPrivate *priv;
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
* correctly render alpha values.
@ -1428,8 +1479,7 @@ clutter_actor_set_depth (ClutterActor *self,
* FIXME: This is sub optimal. maybe queue the the sort
* before stacking
*/
clutter_group_sort_depth_order
(CLUTTER_GROUP(self->priv->parent_actor));
clutter_group_sort_depth_order (CLUTTER_GROUP (priv->parent_actor));
}
}

View File

@ -50,19 +50,19 @@ G_BEGIN_DECLS
#define CLUTTER_ACTOR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass))
#define CLUTTER_ACTOR_SET_FLAGS(e,f) ((e)->flags |= (f))
#define CLUTTER_ACTOR_UNSET_FLAGS(e,f) ((e)->flags &= ~(f))
#define CLUTTER_ACTOR_SET_FLAGS(e,f) ((e)->flags |= (f))
#define CLUTTER_ACTOR_UNSET_FLAGS(e,f) ((e)->flags &= ~(f))
#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_VISIBLE(e) \
(CLUTTER_ACTOR_IS_MAPPED(e) && CLUTTER_ACTOR_IS_REALIZED(e))
#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_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \
CLUTTER_ACTOR_IS_REALIZED (e))
typedef struct _ClutterActor ClutterActor;
typedef struct _ClutterActorClass ClutterActorClass;
typedef struct _ClutterActorBox ClutterActorBox;
typedef struct _ClutterActorPrivate ClutterActorPrivate;
typedef struct _ClutterGeometry ClutterGeometry;
typedef struct _ClutterGeometry ClutterGeometry;
typedef void (*ClutterCallback) (ClutterActor *actor, gpointer data);
#define CLUTTER_CALLBACK(f) ((ClutterCallback) (f))
@ -108,7 +108,9 @@ struct _ClutterActorClass
GObjectClass parent_class;
void (* show) (ClutterActor *actor);
void (* show_all) (ClutterActor *actor);
void (* hide) (ClutterActor *actor);
void (* hide_all) (ClutterActor *actor);
void (* realize) (ClutterActor *actor);
void (* unrealize) (ClutterActor *actor);
void (* paint) (ClutterActor *actor);
@ -125,8 +127,6 @@ struct _ClutterActorClass
void (* destroy) (ClutterActor *actor);
/* to go ? */
void (* show_all) (ClutterActor *actor);
void (* hide_all) (ClutterActor *actor);
void (* queue_redraw) (ClutterActor *actor);
/* padding for future expansion */
@ -140,7 +140,9 @@ struct _ClutterActorClass
GType clutter_actor_get_type (void) G_GNUC_CONST;
void clutter_actor_show (ClutterActor *self);
void clutter_actor_show_all (ClutterActor *self);
void clutter_actor_hide (ClutterActor *self);
void clutter_actor_hide_all (ClutterActor *self);
void clutter_actor_realize (ClutterActor *self);
void clutter_actor_unrealize (ClutterActor *self);
void clutter_actor_paint (ClutterActor *self);

View File

@ -55,6 +55,16 @@
#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 *
clutter_knot_copy (const ClutterKnot *knot)
{
@ -67,6 +77,14 @@ clutter_knot_copy (const ClutterKnot *knot)
return copy;
}
/**
* clutter_knot_free:
* @knot: a #ClutterKnot
*
* Frees the memory of an allocated knot.
*
* Since: 0.2
*/
void
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
clutter_knot_equal (const ClutterKnot *knot_a,
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_b != NULL, FALSE);
if (knot_a == knot_b)
return TRUE;
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
* @scale_begin: initial scale factor
* @scale_end: final scale factor
* @gravity: FIXME
*
* 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:
* @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
* with g_slist_free() when finished using it.
@ -386,14 +386,14 @@ clutter_behaviour_set_alpha (ClutterBehaviour *behave,
* Since: 0.2
*/
GSList *
clutter_behaviour_get_actors (ClutterBehaviour *behaviour)
clutter_behaviour_get_actors (ClutterBehaviour *behave)
{
GSList *retval, *l;
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behaviour), NULL);
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), 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);
return g_slist_reverse (retval);

View File

@ -35,6 +35,7 @@
#include "clutter-clone-texture.h"
#include "clutter-main.h"
#include "clutter-feature.h"
#include "clutter-actor.h"
#include "clutter-util.h"
#include "clutter-enum-types.h"
#include "clutter-private.h"
@ -121,11 +122,11 @@ clone_texture_render_to_gl_quad (ClutterCloneTexture *ctexture,
clutter_texture_get_n_tiles (priv->parent_texture, &n_x_tiles, &n_y_tiles);
for (x=0; x < n_x_tiles; x++)
for (x = 0; x < n_x_tiles; x++)
{
lasty = 0;
for (y=0; y < n_y_tiles; y++)
for (y = 0; y < n_y_tiles; y++)
{
gint actual_w, actual_h;
gint xpos, ypos, xsize, ysize, ywaste, xwaste;
@ -180,6 +181,9 @@ clutter_clone_texture_paint (ClutterActor *self)
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
* realised with resources available.
@ -190,17 +194,17 @@ clutter_clone_texture_paint (ClutterActor *self)
/* FIXME: figure out nicer way of getting at this info...
*/
if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE)
&& clutter_texture_is_tiled (CLUTTER_TEXTURE(parent_texture)) == FALSE)
if (clutter_feature_available (CLUTTER_FEATURE_TEXTURE_RECTANGLE) &&
clutter_texture_is_tiled (CLUTTER_TEXTURE (parent_texture)) == FALSE)
target_type = GL_TEXTURE_RECTANGLE_ARB;
else
target_type = GL_TEXTURE_2D;
glEnable(GL_BLEND);
glEnable(target_type);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
glEnable (target_type);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4ub(255, 255, 255, clutter_actor_get_opacity(self));
glColor4ub (255, 255, 255, clutter_actor_get_opacity (self));
clutter_actor_get_coords (self, &x1, &y1, &x2, &y2);
@ -210,10 +214,10 @@ clutter_clone_texture_paint (ClutterActor *self)
clutter_actor_get_opacity (self));
/* Parent paint translated us into position */
clone_texture_render_to_gl_quad (CLUTTER_CLONE_TEXTURE(self),
clone_texture_render_to_gl_quad (CLUTTER_CLONE_TEXTURE (self),
0, 0, x2 - x1, y2 - y1);
glDisable(target_type);
glDisable(GL_BLEND);
glDisable (target_type);
glDisable (GL_BLEND);
}
static void
@ -221,6 +225,7 @@ set_parent_texture (ClutterCloneTexture *ctexture,
ClutterTexture *texture)
{
ClutterCloneTexturePrivate *priv = ctexture->priv;
ClutterActor *actor = CLUTTER_ACTOR (ctexture);
if (priv->parent_texture)
{
@ -228,16 +233,22 @@ set_parent_texture (ClutterCloneTexture *ctexture,
priv->parent_texture = NULL;
}
clutter_actor_hide (actor);
if (texture)
{
gint width, height;
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_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);
}
}
@ -303,10 +314,10 @@ clutter_clone_texture_get_property (GObject *object,
static void
clutter_clone_texture_class_init (ClutterCloneTextureClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
actor_class->paint = clutter_clone_texture_paint;
actor_class->paint = clutter_clone_texture_paint;
gobject_class->finalize = clutter_clone_texture_finalize;
gobject_class->dispose = clutter_clone_texture_dispose;
@ -319,7 +330,7 @@ clutter_clone_texture_class_init (ClutterCloneTextureClass *klass)
"Parent Texture",
"The parent texture to clone",
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));
}
@ -335,19 +346,64 @@ clutter_clone_texture_init (ClutterCloneTexture *self)
/**
* clutter_clone_texture_new:
* @texture: a #ClutterTexture
* @texture: a #ClutterTexture or %NULL
*
* 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
*/
ClutterActor *
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,
"parent-texture", texture,
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
#define _HAVE_CLUTTER_CLONE_TEXTURE_H
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <clutter/clutter-actor.h>
#include <clutter/clutter-texture.h>
G_BEGIN_DECLS
@ -77,8 +76,12 @@ struct _ClutterCloneTextureClass
void (*_clutter_clone_4) (void);
};
GType clutter_clone_texture_get_type (void);
ClutterActor *clutter_clone_texture_new (ClutterTexture *texture);
GType clutter_clone_texture_get_type (void) G_GNUC_CONST;
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

View File

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

View File

@ -113,26 +113,21 @@ union _ClutterEvent
GType clutter_event_get_type (void) G_GNUC_CONST;
ClutterEvent *clutter_event_new (ClutterEventType type);
ClutterEvent *clutter_event_copy (ClutterEvent *event);
void clutter_event_free (ClutterEvent *event);
ClutterEventType clutter_key_event_type (ClutterKeyEvent *keyev);
guint32 clutter_key_event_time (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);
guint16 clutter_key_event_code (ClutterKeyEvent *keyev);
ClutterEvent *clutter_event_new (ClutterEventType type);
ClutterEvent *clutter_event_copy (ClutterEvent *event);
void clutter_event_free (ClutterEvent *event);
ClutterEventType clutter_event_type (ClutterEvent *keyev);
guint32 clutter_key_event_time (ClutterKeyEvent *keyev);
guint clutter_key_event_state (ClutterKeyEvent *keyev);
guint clutter_key_event_symbol (ClutterKeyEvent *keyev);
guint16 clutter_key_event_code (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);
G_END_DECLS

View File

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

View File

@ -158,23 +158,39 @@ clutter_group_finalize (GObject *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
clutter_group_class_init (ClutterGroupClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
actor_class->paint = clutter_group_paint;
/*
actor_class->show = clutter_group_show_all;
actor_class->hide = clutter_group_hide_all;
*/
actor_class->paint = clutter_group_paint;
actor_class->show_all = clutter_group_real_show_all;
actor_class->hide_all = clutter_group_real_hide_all;
actor_class->request_coords = clutter_group_request_coords;
actor_class->allocate_coords = clutter_group_allocate_coords;
/* GObject */
object_class->finalize = clutter_group_finalize;
object_class->dispose = clutter_group_dispose;
object_class->finalize = clutter_group_finalize;
object_class->dispose = clutter_group_dispose;
group_signals[ADD] =
g_signal_new ("add",
@ -272,17 +288,19 @@ clutter_group_foreach (ClutterGroup *self,
* clutter_group_show_all:
* @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
clutter_group_show_all (ClutterGroup *self)
{
g_return_if_fail (CLUTTER_IS_GROUP (self));
clutter_actor_show(CLUTTER_ACTOR(self));
clutter_actor_show (CLUTTER_ACTOR (self));
g_list_foreach (self->priv->children,
(GFunc)clutter_actor_show,
(GFunc) clutter_actor_show,
NULL);
}
@ -290,8 +308,10 @@ clutter_group_show_all (ClutterGroup *self)
* clutter_group_hide_all:
* @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
clutter_group_hide_all (ClutterGroup *self)
{
@ -300,7 +320,7 @@ clutter_group_hide_all (ClutterGroup *self)
clutter_actor_hide(CLUTTER_ACTOR(self));
g_list_foreach (self->priv->children,
(GFunc)clutter_actor_hide,
(GFunc) clutter_actor_hide,
NULL);
}

View File

@ -238,17 +238,29 @@ sync_gl_viewport (ClutterStage *stage)
static void
clutter_stage_show (ClutterActor *self)
{
if (clutter_stage_get_xwindow (CLUTTER_STAGE(self)))
XMapWindow (clutter_xdisplay(),
clutter_stage_get_xwindow (CLUTTER_STAGE(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)))
XMapWindow (clutter_xdisplay (),
clutter_stage_get_xwindow (CLUTTER_STAGE (self)));
}
static void
clutter_stage_hide (ClutterActor *self)
{
if (clutter_stage_get_xwindow (CLUTTER_STAGE(self)))
XUnmapWindow (clutter_xdisplay(),
clutter_stage_get_xwindow (CLUTTER_STAGE(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)))
XUnmapWindow (clutter_xdisplay (),
clutter_stage_get_xwindow (CLUTTER_STAGE (self)));
}
static void

View File

@ -639,12 +639,26 @@ clutter_texture_realize (ClutterActor *actor)
static void
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);
}
static void
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);
}

View File

@ -26,9 +26,8 @@
#ifndef _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 <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
@ -54,10 +53,18 @@ struct _ClutterTextureClass
{
ClutterActorClass parent_class;
void (*size_change) (ClutterTexture *texture,
gint width,
gint height);
void (*size_change) (ClutterTexture *texture,
gint width,
gint height);
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,13 +48,13 @@ main (int argc, char *argv[])
clutter_rectangle_set_border_color (CLUTTER_RECTANGLE (rect),
&rect_border_color);
clutter_actor_show (rect);
hand = clutter_texture_new_from_pixbuf (pixbuf);
clutter_actor_set_position (hand, 0, 0);
clutter_actor_show (hand);
clutter_group_add_many (CLUTTER_GROUP (group), rect, hand, NULL);
/* Make a timeline */
timeline = clutter_timeline_new (100, 26); /* num frames, fps */
g_object_set (timeline, "loop", TRUE, 0);
@ -77,7 +77,7 @@ main (int argc, char *argv[])
/* start the timeline and thus the animations */
clutter_timeline_start (timeline);
clutter_group_show_all (CLUTTER_GROUP (stage));
clutter_actor_show_all (stage);
clutter_main();

View File

@ -242,8 +242,7 @@ main (int argc, char *argv[])
clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR(oh->group));
/* Show everying ( and map window ) */
clutter_group_show_all (CLUTTER_GROUP (oh->group));
clutter_group_show_all (CLUTTER_GROUP (stage));
clutter_actor_show_all (stage);
g_signal_connect (stage, "button-press-event",
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_group_show_all (CLUTTER_GROUP (stage));
clutter_actor_show_all (CLUTTER_ACTOR (stage));
timeline = clutter_timeline_new (360, 200);
g_object_set (timeline, "loop", TRUE, 0);