2006-06-13 09:17:45 -04:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 OpenedHand
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2006-06-21 18:34:25 -04:00
|
|
|
* SECTION:clutter-actor
|
2006-06-13 09:17:45 -04:00
|
|
|
* @short_description: Base abstract class for all visual stage actors.
|
|
|
|
*
|
2007-06-16 16:58:00 -04:00
|
|
|
* #ClutterActor is a base abstract class for all visual elements on the
|
|
|
|
* stage. Every object that must appear on the main #ClutterStage must also
|
|
|
|
* be a #ClutterActor, either by using one of the classes provided by
|
|
|
|
* Clutter, or by implementing a new #ClutterActor subclass.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "clutter-actor.h"
|
2007-06-07 10:41:35 -04:00
|
|
|
#include "clutter-container.h"
|
2006-06-13 09:17:45 -04:00
|
|
|
#include "clutter-main.h"
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
#include "clutter-enum-types.h"
|
|
|
|
#include "clutter-marshal.h"
|
2006-06-13 09:17:45 -04:00
|
|
|
#include "clutter-private.h"
|
2006-12-04 11:26:35 -05:00
|
|
|
#include "clutter-debug.h"
|
2007-05-22 05:31:40 -04:00
|
|
|
#include "clutter-units.h"
|
2007-04-27 17:13:06 -04:00
|
|
|
#include "cogl.h"
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
G_DEFINE_ABSTRACT_TYPE (ClutterActor,
|
|
|
|
clutter_actor,
|
|
|
|
G_TYPE_INITIALLY_UNOWNED);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
static guint32 __id = 0;
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
#define CLUTTER_ACTOR_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ACTOR, ClutterActorPrivate))
|
|
|
|
|
|
|
|
struct _ClutterActorPrivate
|
|
|
|
{
|
2007-05-22 05:31:40 -04:00
|
|
|
ClutterActorBox coords;
|
2007-05-18 03:30:06 -04:00
|
|
|
|
2007-06-22 11:16:40 -04:00
|
|
|
ClutterGeometry clip; /* FIXME: Should be Units */
|
2007-04-27 17:13:06 -04:00
|
|
|
guint has_clip : 1;
|
|
|
|
ClutterFixed rxang, ryang, rzang; /* Rotation*/
|
2007-06-22 11:16:40 -04:00
|
|
|
gint rzx, rzy, rxy, rxz, ryx, ryz; /* FIXME: Should be Units */
|
2007-04-27 17:13:06 -04:00
|
|
|
gint z;
|
|
|
|
guint8 opacity;
|
|
|
|
ClutterActor *parent_actor;
|
|
|
|
gchar *name;
|
|
|
|
ClutterFixed scale_x, scale_y;
|
|
|
|
guint32 id; /* Unique ID */
|
2006-06-13 09:17:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_X,
|
|
|
|
PROP_Y,
|
|
|
|
PROP_WIDTH,
|
|
|
|
PROP_HEIGHT,
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
PROP_CLIP,
|
|
|
|
PROP_HAS_CLIP,
|
2006-06-13 09:17:45 -04:00
|
|
|
PROP_OPACITY,
|
|
|
|
PROP_NAME,
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
PROP_VISIBLE
|
2006-06-13 09:17:45 -04:00
|
|
|
};
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SHOW,
|
|
|
|
HIDE,
|
|
|
|
DESTROY,
|
2006-11-20 07:02:24 -05:00
|
|
|
PARENT_SET,
|
2007-08-13 16:48:01 -04:00
|
|
|
EVENT,
|
|
|
|
EVENT_AFTER,
|
|
|
|
BUTTON_PRESS_EVENT,
|
|
|
|
BUTTON_RELEASE_EVENT,
|
|
|
|
SCROLL_EVENT,
|
|
|
|
KEY_PRESS_EVENT,
|
|
|
|
KEY_RELEASE_EVENT,
|
|
|
|
MOTION_EVENT,
|
|
|
|
FOCUS_IN,
|
|
|
|
FOCUS_OUT,
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint actor_signals[LAST_SIGNAL] = { 0, };
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
static gboolean
|
|
|
|
redraw_update_idle (gpointer data)
|
|
|
|
{
|
|
|
|
ClutterMainContext *ctx = CLUTTER_CONTEXT();
|
|
|
|
|
|
|
|
if (ctx->update_idle)
|
|
|
|
{
|
|
|
|
g_source_remove (ctx->update_idle);
|
|
|
|
ctx->update_idle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
clutter_redraw ();
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_show
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Flags a clutter actor to be displayed. An actor not shown will not
|
|
|
|
* appear on the display.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_show (ClutterActor *self)
|
|
|
|
{
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
{
|
|
|
|
g_object_ref (self);
|
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
g_signal_emit (self, actor_signals[SHOW], 0);
|
|
|
|
g_object_notify (G_OBJECT (self), "visible");
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
g_object_unref (self);
|
|
|
|
}
|
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
/**
|
|
|
|
* clutter_actor_show_all:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
2007-08-05 09:37:49 -04:00
|
|
|
* Call show() on all children of a actor (if any).
|
2006-12-12 15:20:04 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_show_all (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorClass *klass;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
if (klass->show_all)
|
|
|
|
klass->show_all (self);
|
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
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);
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_hide
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Flags a clutter actor to be hidden. An actor not shown will not
|
|
|
|
* appear on the display.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_hide (ClutterActor *self)
|
|
|
|
{
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
{
|
|
|
|
g_object_ref (self);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
if (CLUTTER_ACTOR_IS_REACTIVE(self))
|
|
|
|
; /* FIXME: decrease global reactive count */
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_signal_emit (self, actor_signals[HIDE], 0);
|
|
|
|
g_object_notify (G_OBJECT (self), "visible");
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_object_unref (self);
|
2007-08-13 16:48:01 -04:00
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
/**
|
|
|
|
* clutter_actor_hide_all:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
2007-08-05 09:37:49 -04:00
|
|
|
* Call hide() on all child actors (if any).
|
2006-12-12 15:20:04 -05:00
|
|
|
*
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_realize
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Creates any underlying graphics resources needed by the actor to be
|
|
|
|
* displayed.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_realize (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorClass *klass;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_REALIZED (self))
|
|
|
|
return;
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
|
|
|
|
|
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
|
|
|
|
if (klass->realize)
|
|
|
|
(klass->realize) (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-06-22 09:05:45 -04:00
|
|
|
* clutter_actor_unrealize
|
2006-06-13 09:17:45 -04:00
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Frees up any underlying graphics resources needed by the actor to be
|
|
|
|
* displayed.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_unrealize (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorClass *klass;
|
|
|
|
|
|
|
|
if (!CLUTTER_ACTOR_IS_REALIZED (self))
|
|
|
|
return;
|
|
|
|
|
|
|
|
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED);
|
|
|
|
|
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
|
|
|
|
if (klass->unrealize)
|
|
|
|
(klass->unrealize) (self);
|
|
|
|
}
|
|
|
|
|
2007-05-28 14:49:34 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_pick:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @color: A #ClutterColor
|
|
|
|
*
|
|
|
|
* Renders a silhouette of the actor in supplied color.
|
|
|
|
*
|
|
|
|
* This function should not never be called directly by applications.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_pick (ClutterActor *self,
|
|
|
|
const ClutterColor *color)
|
|
|
|
{
|
|
|
|
ClutterActorClass *klass;
|
|
|
|
|
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
|
|
|
|
if (G_UNLIKELY(klass->pick))
|
|
|
|
{
|
|
|
|
/* Its pretty unlikely anything other than a container actor
|
|
|
|
* would need to supply its own pick method.
|
|
|
|
*/
|
|
|
|
(klass->pick) (self, color);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cogl_color (color);
|
|
|
|
cogl_rectangle (0,
|
|
|
|
0,
|
|
|
|
clutter_actor_get_width(self),
|
|
|
|
clutter_actor_get_height(self));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-31 05:29:12 -04:00
|
|
|
/*
|
|
|
|
* Utility functions for manipulating transformation matrix
|
|
|
|
*
|
|
|
|
* Matrix: 4x4 of ClutterFixed
|
|
|
|
*/
|
|
|
|
#define M(m,row,col) (m)[col*4+row]
|
|
|
|
|
|
|
|
/* Transform point (x,y,z) by matrix */
|
|
|
|
static void
|
2007-06-12 07:42:29 -04:00
|
|
|
mtx_transform (ClutterFixed m[16],
|
|
|
|
ClutterFixed *x, ClutterFixed *y, ClutterFixed *z,
|
|
|
|
ClutterFixed *w)
|
2007-05-31 05:29:12 -04:00
|
|
|
{
|
2007-06-12 07:42:29 -04:00
|
|
|
ClutterFixed _x, _y, _z, _w;
|
2007-05-31 05:29:12 -04:00
|
|
|
_x = *x;
|
|
|
|
_y = *y;
|
|
|
|
_z = *z;
|
2007-06-12 07:42:29 -04:00
|
|
|
_w = *w;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* We care lot about precission here, so have to use QMUL */
|
2007-06-12 07:42:29 -04:00
|
|
|
*x = CFX_QMUL (M (m,0,0), _x) + CFX_QMUL (M (m,0,1), _y) +
|
|
|
|
CFX_QMUL (M (m,0,2), _z) + CFX_QMUL (M (m,0,3), _w);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
*y = CFX_QMUL (M (m,1,0), _x) + CFX_QMUL (M (m,1,1), _y) +
|
|
|
|
CFX_QMUL (M (m,1,2), _z) + CFX_QMUL (M (m,1,3), _w);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
*z = CFX_QMUL (M (m,2,0), _x) + CFX_QMUL (M (m,2,1), _y) +
|
|
|
|
CFX_QMUL (M (m,2,2), _z) + CFX_QMUL (M (m,2,3), _w);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
*w = CFX_QMUL (M (m,3,0), _x) + CFX_QMUL (M (m,3,1), _y) +
|
|
|
|
CFX_QMUL (M (m,3,2), _z) + CFX_QMUL (M (m,3,3), _w);
|
2007-06-01 07:43:53 -04:00
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* Specially for Matthew: was going to put a comment here, but could not
|
|
|
|
* think of anything at all to say ;)
|
|
|
|
*/
|
2007-05-31 13:11:09 -04:00
|
|
|
}
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* Applies the transforms associated with this actor and its ancestors,
|
|
|
|
* retrieves the resulting OpenGL modelview matrix, and uses the matrix
|
|
|
|
* to transform the supplied point
|
|
|
|
*/
|
2007-06-01 12:20:57 -04:00
|
|
|
static void
|
2007-06-12 07:42:29 -04:00
|
|
|
clutter_actor_transform_point (ClutterActor *actor,
|
|
|
|
ClutterUnit *x,
|
|
|
|
ClutterUnit *y,
|
|
|
|
ClutterUnit *z,
|
|
|
|
ClutterUnit *w)
|
2007-06-01 12:20:57 -04:00
|
|
|
{
|
2007-06-12 07:42:29 -04:00
|
|
|
ClutterFixed mtx[16];
|
|
|
|
ClutterActorPrivate *priv;
|
2007-06-01 12:20:57 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
2007-06-01 12:20:57 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
priv = actor->priv;
|
2007-06-01 12:20:57 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
cogl_push_matrix();
|
|
|
|
_clutter_actor_apply_modelview_transform_recursive (actor);
|
|
|
|
|
|
|
|
cogl_get_modelview_matrix (mtx);
|
2007-06-01 12:20:57 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
mtx_transform (mtx, x, y, z, w);
|
|
|
|
|
|
|
|
cogl_pop_matrix();
|
2007-06-01 12:20:57 -04:00
|
|
|
}
|
|
|
|
|
2007-07-01 12:44:24 -04:00
|
|
|
/* Help macros to scale from OpenGL <-1,1> coordinates system to our
|
2007-06-15 05:53:07 -04:00
|
|
|
* X-window based <0,window-size> coordinates
|
|
|
|
*/
|
|
|
|
#define MTX_GL_SCALE_X(x,w,v1,v2) (CFX_MUL( \
|
2007-06-12 07:42:29 -04:00
|
|
|
((CFX_DIV (x,w) + CFX_ONE) >> 1), v1) \
|
|
|
|
+ v2)
|
|
|
|
|
2007-06-13 07:20:10 -04:00
|
|
|
#define MTX_GL_SCALE_Y(y,w,v1,v2) (v1 - CFX_MUL( \
|
|
|
|
((CFX_DIV (y,w) + CFX_ONE) >> 1), v1) \
|
|
|
|
+ v2)
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
#define MTX_GL_SCALE_Z(z,w,v1,v2) MTX_GL_SCALE_X(z,w,v1,v2)
|
2007-06-12 07:42:29 -04:00
|
|
|
|
2007-05-31 13:11:09 -04:00
|
|
|
/**
|
2007-06-27 11:10:52 -04:00
|
|
|
* clutter_actor_apply_transform_to_point:
|
2007-05-31 13:11:09 -04:00
|
|
|
* @self: A #ClutterActor
|
2007-07-02 05:21:58 -04:00
|
|
|
* @point: A point as #ClutterVertex
|
|
|
|
* @vertex: The translated #ClutterVertex
|
2007-05-31 13:11:09 -04:00
|
|
|
*
|
2007-07-02 05:21:58 -04:00
|
|
|
* Transforms point in coordinates relative to the actor
|
|
|
|
* into screen coordiances
|
2007-05-31 13:11:09 -04:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
**/
|
|
|
|
void
|
2007-07-02 05:21:58 -04:00
|
|
|
clutter_actor_apply_transform_to_point (ClutterActor *self,
|
|
|
|
ClutterVertex *point,
|
|
|
|
ClutterVertex *vertex)
|
2007-06-12 07:42:29 -04:00
|
|
|
{
|
|
|
|
ClutterFixed mtx_p[16];
|
|
|
|
ClutterFixed v[4];
|
|
|
|
ClutterFixed w = CFX_ONE;
|
2007-05-31 13:11:09 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
2007-05-31 13:11:09 -04:00
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* First we tranform the point using the OpenGL modelview matrix */
|
2007-07-02 05:21:58 -04:00
|
|
|
clutter_actor_transform_point (self, &point->x, &point->y, &point->z, &w);
|
2007-05-31 14:22:41 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
cogl_get_projection_matrix (mtx_p);
|
|
|
|
cogl_get_viewport (v);
|
2007-06-15 05:53:07 -04:00
|
|
|
|
|
|
|
/* Now, transform it again with the projection matrix */
|
2007-07-02 05:21:58 -04:00
|
|
|
mtx_transform (mtx_p, &point->x, &point->y, &point->z, &w);
|
2007-05-31 13:11:09 -04:00
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* Finaly translate from OpenGL coords to window coords */
|
2007-07-02 05:21:58 -04:00
|
|
|
vertex->x = MTX_GL_SCALE_X(point->x,w,v[2],v[0]);
|
|
|
|
vertex->y = MTX_GL_SCALE_Y(point->y,w,v[3],v[1]);
|
|
|
|
vertex->z = MTX_GL_SCALE_Z(point->z,w,v[2],v[0]);
|
2007-05-31 13:11:09 -04:00
|
|
|
}
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
/* Recursively tranform supplied vertices with the tranform for the current
|
2007-06-15 05:53:07 -04:00
|
|
|
* actor and all its ancestors (like clutter_actor_transform_point() but
|
|
|
|
* for all the vertices in one go).
|
2007-06-12 07:42:29 -04:00
|
|
|
*/
|
|
|
|
static void
|
|
|
|
clutter_actor_transform_vertices (ClutterActor * self,
|
|
|
|
ClutterVertex verts[4],
|
|
|
|
ClutterFixed w[4])
|
2007-05-31 13:11:09 -04:00
|
|
|
{
|
|
|
|
ClutterFixed mtx[16];
|
2007-06-12 07:42:29 -04:00
|
|
|
ClutterFixed _x, _y, _z, _w;
|
2007-05-31 13:11:09 -04:00
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
cogl_push_matrix();
|
|
|
|
_clutter_actor_apply_modelview_transform_recursive (self);
|
2007-06-01 12:20:57 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
cogl_get_modelview_matrix (mtx);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
_x = 0;
|
|
|
|
_y = 0;
|
|
|
|
_z = 0;
|
|
|
|
_w = CFX_ONE;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
mtx_transform (mtx, &_x, &_y, &_z, &_w);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
verts[0].x = _x;
|
|
|
|
verts[0].y = _y;
|
|
|
|
verts[0].z = _z;
|
|
|
|
w[0] = _w;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
_x = priv->coords.x2 - priv->coords.x1;
|
|
|
|
_y = 0;
|
|
|
|
_z = 0;
|
|
|
|
_w = CFX_ONE;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
mtx_transform (mtx, &_x, &_y, &_z, &_w);
|
|
|
|
|
|
|
|
verts[1].x = _x;
|
|
|
|
verts[1].y = _y;
|
|
|
|
verts[1].z = _z;
|
|
|
|
w[1] = _w;
|
|
|
|
|
|
|
|
_x = 0;
|
|
|
|
_y = priv->coords.y2 - priv->coords.y1;
|
|
|
|
_z = 0;
|
|
|
|
_w = CFX_ONE;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
mtx_transform (mtx, &_x, &_y, &_z, &_w);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
verts[2].x = _x;
|
|
|
|
verts[2].y = _y;
|
|
|
|
verts[2].z = _z;
|
|
|
|
w[2] = _w;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
_x = priv->coords.x2 - priv->coords.x1;
|
|
|
|
_y = priv->coords.y2 - priv->coords.y1;
|
|
|
|
_z = 0;
|
|
|
|
_w = CFX_ONE;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
mtx_transform (mtx, &_x, &_y, &_z, &_w);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
verts[3].x = _x;
|
|
|
|
verts[3].y = _y;
|
|
|
|
verts[3].z = _z;
|
|
|
|
w[3] = _w;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
cogl_pop_matrix();
|
2007-05-31 05:29:12 -04:00
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
2007-06-27 11:10:52 -04:00
|
|
|
* clutter_actor_get_vertices:
|
2006-06-13 09:17:45 -04:00
|
|
|
* @self: A #ClutterActor
|
2007-06-12 07:42:29 -04:00
|
|
|
* @verts: Pointer to a location of an array of 4 #ClutterVertex where to
|
|
|
|
* store the result.
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Calculates the tranformed screen coordinaces of the four corners of
|
2007-06-27 11:10:42 -04:00
|
|
|
* the actor; the returned vertices relate to the ClutterActoBox
|
|
|
|
* coordinances as follows:
|
|
|
|
*
|
2007-08-15 15:50:31 -04:00
|
|
|
* v[0] contains (x1, y1)
|
|
|
|
* v[1] contains (x2, y1)
|
|
|
|
* v[2] contains (x1, y2)
|
|
|
|
* v[3] contains (x2, y2)
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-12 07:42:29 -04:00
|
|
|
* Since: 0.4
|
2006-06-13 09:17:45 -04:00
|
|
|
**/
|
|
|
|
void
|
2007-07-01 12:44:24 -04:00
|
|
|
clutter_actor_get_vertices (ClutterActor *self,
|
|
|
|
ClutterVertex verts[4])
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-06-12 07:42:29 -04:00
|
|
|
ClutterFixed mtx_p[16];
|
|
|
|
ClutterFixed v[4];
|
|
|
|
ClutterFixed w[4];
|
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
2007-06-12 07:42:29 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
priv = self->priv;
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
clutter_actor_transform_vertices (self, verts, w);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
cogl_get_projection_matrix (mtx_p);
|
|
|
|
cogl_get_viewport (v);
|
|
|
|
|
|
|
|
mtx_transform (mtx_p,
|
|
|
|
&verts[0].x,
|
|
|
|
&verts[0].y,
|
|
|
|
&verts[0].z,
|
|
|
|
&w[0]);
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[0].x = MTX_GL_SCALE_X (verts[0].x, w[0], v[2], v[0]);
|
2007-06-13 07:20:10 -04:00
|
|
|
verts[0].y = MTX_GL_SCALE_Y (verts[0].y, w[0], v[3], v[1]);
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[0].z = MTX_GL_SCALE_Z (verts[0].z, w[0], v[2], v[0]);
|
2007-06-12 07:42:29 -04:00
|
|
|
|
|
|
|
mtx_transform (mtx_p,
|
|
|
|
&verts[1].x,
|
|
|
|
&verts[1].y,
|
|
|
|
&verts[1].z,
|
|
|
|
&w[1]);
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[1].x = MTX_GL_SCALE_X (verts[1].x, w[1], v[2], v[0]);
|
2007-06-13 07:20:10 -04:00
|
|
|
verts[1].y = MTX_GL_SCALE_Y (verts[1].y, w[1], v[3], v[1]);
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[1].z = MTX_GL_SCALE_Z (verts[1].z, w[1], v[2], v[0]);
|
2007-06-12 07:42:29 -04:00
|
|
|
|
|
|
|
mtx_transform (mtx_p,
|
|
|
|
&verts[2].x,
|
|
|
|
&verts[2].y,
|
|
|
|
&verts[2].z,
|
|
|
|
&w[2]);
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[2].x = MTX_GL_SCALE_X (verts[2].x, w[2], v[2], v[0]);
|
2007-06-13 07:20:10 -04:00
|
|
|
verts[2].y = MTX_GL_SCALE_Y (verts[2].y, w[2], v[3], v[1]);
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[2].z = MTX_GL_SCALE_Z (verts[2].z, w[2], v[2], v[0]);
|
2007-06-12 07:42:29 -04:00
|
|
|
|
|
|
|
mtx_transform (mtx_p,
|
|
|
|
&verts[3].x,
|
|
|
|
&verts[3].y,
|
|
|
|
&verts[3].z,
|
|
|
|
&w[3]);
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[3].x = MTX_GL_SCALE_X (verts[3].x, w[3], v[2], v[0]);
|
2007-06-13 07:20:10 -04:00
|
|
|
verts[3].y = MTX_GL_SCALE_Y (verts[3].y, w[3], v[3], v[1]);
|
2007-06-15 05:53:07 -04:00
|
|
|
verts[3].z = MTX_GL_SCALE_Z (verts[3].z, w[3], v[2], v[0]);
|
2007-06-12 07:42:29 -04:00
|
|
|
}
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* Applies the transforms associated with this actor to the
|
|
|
|
* OpenGL modelview matrix.
|
|
|
|
*
|
|
|
|
* This function does not push/pop matrix; it is the responsibility
|
|
|
|
* of the caller to do so as appropriate
|
|
|
|
*/
|
2007-06-12 07:42:29 -04:00
|
|
|
void
|
|
|
|
_clutter_actor_apply_modelview_transform (ClutterActor * self)
|
|
|
|
{
|
|
|
|
ClutterActorPrivate *priv = self->priv;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-09-20 14:38:08 -04:00
|
|
|
if (clutter_actor_get_parent (self) != NULL)
|
|
|
|
{
|
2007-05-25 06:56:09 -04:00
|
|
|
cogl_translate (CLUTTER_UNITS_TO_INT (priv->coords.x1),
|
|
|
|
CLUTTER_UNITS_TO_INT (priv->coords.y1),
|
2007-04-27 17:13:06 -04:00
|
|
|
0);
|
2006-09-20 14:38:08 -04:00
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-06-27 07:34:43 -04:00
|
|
|
/*
|
|
|
|
* because the rotation involves translations, we must scale before
|
|
|
|
* applying the rotations (if we apply the scale after the rotations,
|
|
|
|
* the translations included in the rotation are not scaled and so the
|
|
|
|
* entire object will move on the screen as a result of rotating it).
|
|
|
|
*/
|
|
|
|
if (priv->scale_x != CFX_ONE ||
|
|
|
|
priv->scale_y != CFX_ONE)
|
|
|
|
{
|
|
|
|
cogl_scale (priv->scale_x, priv->scale_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->rzang)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (priv->rzx, priv->rzy, 0);
|
2007-04-27 17:13:06 -04:00
|
|
|
cogl_rotatex (priv->rzang, 0, 0, CFX_ONE);
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (-priv->rzx, -priv->rzy, 0);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
if (priv->ryang)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (priv->ryx, 0, priv->z + priv->ryz);
|
2007-04-27 17:13:06 -04:00
|
|
|
cogl_rotatex (priv->ryang, 0, CFX_ONE, 0);
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (-priv->ryx, 0, -(priv->z + priv->ryz));
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
if (priv->rxang)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (0, priv->rxy, priv->z + priv->rxz);
|
2007-06-15 19:15:34 -04:00
|
|
|
cogl_rotatex (priv->rxang, CFX_ONE, 0, 0);
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (0, -priv->rxy, -(priv->z - priv->rxz));
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
if (priv->z)
|
2007-05-02 05:01:11 -04:00
|
|
|
cogl_translate (0, 0, priv->z);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
if (priv->has_clip)
|
2007-05-28 14:49:34 -04:00
|
|
|
cogl_clip_set (&(priv->clip));
|
2007-06-12 07:42:29 -04:00
|
|
|
}
|
|
|
|
|
2007-06-15 05:53:07 -04:00
|
|
|
/* Recursively applies the transforms associated with this actor and
|
|
|
|
* its ancestors to the OpenGL modelview matrix.
|
|
|
|
*
|
|
|
|
* This function does not push/pop matrix; it is the responsibility
|
|
|
|
* of the caller to do so as appropriate
|
|
|
|
*/
|
2007-06-12 07:42:29 -04:00
|
|
|
void
|
|
|
|
_clutter_actor_apply_modelview_transform_recursive (ClutterActor * self)
|
|
|
|
{
|
|
|
|
ClutterActor * parent;
|
|
|
|
|
|
|
|
parent = clutter_actor_get_parent (self);
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
_clutter_actor_apply_modelview_transform_recursive (parent);
|
2007-07-30 03:27:14 -04:00
|
|
|
|
|
|
|
_clutter_actor_apply_modelview_transform (self);
|
2007-06-12 07:42:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_paint:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Renders the actor to display.
|
|
|
|
*
|
|
|
|
* This function should not be called directly by applications instead
|
|
|
|
* #clutter_actor_queue_redraw should be used to queue paints.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_paint (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
ClutterActorClass *klass;
|
|
|
|
ClutterMainContext *context;
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (!CLUTTER_ACTOR_IS_REALIZED (self))
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (PAINT, "Attempting realize via paint()");
|
|
|
|
clutter_actor_realize(self);
|
|
|
|
|
|
|
|
if (!CLUTTER_ACTOR_IS_REALIZED (self))
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (PAINT, "Attempt failed, aborting paint");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
context = clutter_context_get_default ();
|
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
|
|
|
|
cogl_push_matrix();
|
|
|
|
|
|
|
|
_clutter_actor_apply_modelview_transform (self);
|
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
if (G_UNLIKELY(context->pick_mode != CLUTTER_PICK_NONE))
|
2007-05-28 14:49:34 -04:00
|
|
|
{
|
2007-07-12 06:15:19 -04:00
|
|
|
gint r, g, b;
|
2007-05-28 14:49:34 -04:00
|
|
|
ClutterColor col;
|
|
|
|
guint32 id;
|
2007-01-04 14:56:01 -05:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
if (context->pick_mode == CLUTTER_PICK_ALL
|
|
|
|
|| (context->pick_mode == CLUTTER_PICK_REACTIVE
|
|
|
|
&& CLUTTER_ACTOR_IS_REACTIVE(self)))
|
|
|
|
{
|
|
|
|
id = clutter_actor_get_id (self);
|
|
|
|
|
|
|
|
cogl_get_bitmasks (&r, &g, &b, NULL);
|
|
|
|
|
|
|
|
/* Encode the actor id into a color, taking into account bpp */
|
|
|
|
col.red = ((id >> (g+b)) & (0xff>>(8-r)))<<(8-r);
|
|
|
|
col.green = ((id >> b) & (0xff>>(8-g))) << (8-g);
|
|
|
|
col.blue = (id & (0xff>>(8-b)))<<(8-b);
|
|
|
|
col.alpha = 0xff;
|
|
|
|
|
|
|
|
/* Actor will then paint silhouette of itself in supplied
|
|
|
|
* color. See clutter_stage_get_actor_at_pos() for where
|
|
|
|
* picking is enabled.
|
|
|
|
*/
|
|
|
|
clutter_actor_pick (self, &col);
|
|
|
|
}
|
2007-05-28 14:49:34 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (G_LIKELY(klass->paint))
|
|
|
|
(klass->paint) (self);
|
2006-08-13 19:55:52 -04:00
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-03-22 14:21:59 -04:00
|
|
|
if (priv->has_clip)
|
2007-05-28 14:49:34 -04:00
|
|
|
cogl_clip_unset();
|
2006-08-13 19:55:52 -04:00
|
|
|
|
2007-04-27 17:13:06 -04:00
|
|
|
cogl_pop_matrix();
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
#undef M
|
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_request_coords:
|
|
|
|
* @self: A #ClutterActor
|
2007-06-22 11:16:40 -04:00
|
|
|
* @box: A #ClutterActorBox with requested new co-ordinates in ClutterUnits
|
2007-05-22 05:31:40 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Requests new untransformed co-ordinates for the #ClutterActor
|
|
|
|
* ralative to any parent.
|
2007-05-22 05:31:40 -04:00
|
|
|
*
|
|
|
|
* This function should not be called directly by applications instead
|
|
|
|
* the various position/geometry methods should be used.
|
|
|
|
**/
|
2006-06-13 09:17:45 -04:00
|
|
|
void
|
2007-05-22 05:31:40 -04:00
|
|
|
clutter_actor_request_coords (ClutterActor *self,
|
|
|
|
ClutterActorBox *box)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
ClutterActorClass *klass;
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
gboolean x_change, y_change, width_change, height_change;
|
2007-05-18 03:30:06 -04:00
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
|
|
|
|
if (klass->request_coords)
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
klass->request_coords (self, box);
|
2007-05-18 03:30:06 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
x_change = (self->priv->coords.x1 != box->x1);
|
|
|
|
y_change = (self->priv->coords.y1 != box->y1);
|
|
|
|
width_change = ((self->priv->coords.x2 - self->priv->coords.x1) !=
|
|
|
|
(box->x2 - box->x1));
|
|
|
|
height_change = ((self->priv->coords.y2 - self->priv->coords.y1) !=
|
|
|
|
(box->y2 - box->y1));
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-08-29 15:09:43 -04:00
|
|
|
if (x_change || y_change || width_change || height_change)
|
|
|
|
{
|
|
|
|
self->priv->coords.x1 = box->x1;
|
|
|
|
self->priv->coords.y1 = box->y1;
|
|
|
|
self->priv->coords.x2 = box->x2;
|
|
|
|
self->priv->coords.y2 = box->y2;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
2007-05-18 03:30:06 -04:00
|
|
|
|
2007-04-19 11:24:04 -04:00
|
|
|
g_object_ref (self);
|
|
|
|
g_object_freeze_notify (G_OBJECT (self));
|
2006-08-29 15:09:43 -04:00
|
|
|
|
|
|
|
if (x_change)
|
|
|
|
g_object_notify (G_OBJECT (self), "x");
|
|
|
|
|
|
|
|
if (y_change)
|
|
|
|
g_object_notify (G_OBJECT (self), "y");
|
|
|
|
|
|
|
|
if (width_change)
|
|
|
|
g_object_notify (G_OBJECT (self), "width");
|
|
|
|
|
|
|
|
if (height_change)
|
|
|
|
g_object_notify (G_OBJECT (self), "height");
|
2007-04-19 11:24:04 -04:00
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (self));
|
|
|
|
g_object_unref (self);
|
2006-08-29 15:09:43 -04:00
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-06-13 19:24:59 -04:00
|
|
|
* clutter_actor_query_coords:
|
2006-06-13 09:17:45 -04:00
|
|
|
* @self: A #ClutterActor
|
2007-05-22 05:31:40 -04:00
|
|
|
* @box: A location to store the actors #ClutterActorBox co-ordinates
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Requests the untransformed co-ordinates (in ClutterUnits) for the
|
|
|
|
* #ClutterActor relative to any parent.
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
|
|
|
* This function should not be called directly by applications instead
|
|
|
|
* the various position/geometry methods should be used.
|
|
|
|
**/
|
|
|
|
void
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (ClutterActor *self,
|
|
|
|
ClutterActorBox *box)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
ClutterActorClass *klass;
|
|
|
|
|
|
|
|
klass = CLUTTER_ACTOR_GET_CLASS (self);
|
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
box->x1 = self->priv->coords.x1;
|
|
|
|
box->y1 = self->priv->coords.y1;
|
|
|
|
box->x2 = self->priv->coords.x2;
|
|
|
|
box->y2 = self->priv->coords.y2;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
if (klass->query_coords)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
/* FIXME: This is kind of a cludge - we pass out *private*
|
|
|
|
* co-ords down to any subclasses so they can modify
|
|
|
|
* we then resync any changes. Needed for group class.
|
|
|
|
* Need to figure out nicer way.
|
|
|
|
*/
|
2007-06-13 19:24:59 -04:00
|
|
|
klass->query_coords(self, box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
self->priv->coords.x1 = box->x1;
|
|
|
|
self->priv->coords.y1 = box->y1;
|
|
|
|
self->priv->coords.x2 = box->x2;
|
|
|
|
self->priv->coords.y2 = box->y2;
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_actor_set_property (GObject *object,
|
2007-06-14 11:29:52 -04:00
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
ClutterActor *actor;
|
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
|
|
|
|
actor = CLUTTER_ACTOR(object);
|
|
|
|
priv = actor->priv;
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_X:
|
|
|
|
clutter_actor_set_position (actor,
|
2007-06-14 11:29:52 -04:00
|
|
|
g_value_get_int (value),
|
|
|
|
clutter_actor_get_y (actor));
|
2006-06-13 09:17:45 -04:00
|
|
|
break;
|
|
|
|
case PROP_Y:
|
|
|
|
clutter_actor_set_position (actor,
|
2007-06-14 11:29:52 -04:00
|
|
|
clutter_actor_get_x (actor),
|
|
|
|
g_value_get_int (value));
|
2006-06-13 09:17:45 -04:00
|
|
|
break;
|
|
|
|
case PROP_WIDTH:
|
|
|
|
clutter_actor_set_size (actor,
|
2007-06-14 11:29:52 -04:00
|
|
|
g_value_get_int (value),
|
|
|
|
clutter_actor_get_height (actor));
|
2006-06-13 09:17:45 -04:00
|
|
|
break;
|
|
|
|
case PROP_HEIGHT:
|
|
|
|
clutter_actor_set_size (actor,
|
2007-06-14 11:29:52 -04:00
|
|
|
clutter_actor_get_width (actor),
|
|
|
|
g_value_get_int (value));
|
2006-06-13 09:17:45 -04:00
|
|
|
break;
|
|
|
|
case PROP_OPACITY:
|
|
|
|
clutter_actor_set_opacity (actor, g_value_get_uchar (value));
|
|
|
|
break;
|
|
|
|
case PROP_NAME:
|
|
|
|
clutter_actor_set_name (actor, g_value_get_string (value));
|
|
|
|
break;
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
case PROP_VISIBLE:
|
|
|
|
if (g_value_get_boolean (value) == TRUE)
|
|
|
|
clutter_actor_show (actor);
|
|
|
|
else
|
|
|
|
clutter_actor_hide (actor);
|
|
|
|
break;
|
2006-07-06 14:12:19 -04:00
|
|
|
case PROP_CLIP:
|
|
|
|
{
|
|
|
|
ClutterGeometry *geom = g_value_get_boxed (value);
|
|
|
|
|
|
|
|
clutter_actor_set_clip (actor,
|
|
|
|
geom->x, geom->y,
|
|
|
|
geom->width, geom->height);
|
|
|
|
}
|
|
|
|
break;
|
2006-06-13 09:17:45 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_actor_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
|
|
|
|
actor = CLUTTER_ACTOR(object);
|
|
|
|
priv = actor->priv;
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_X:
|
|
|
|
g_value_set_int (value, clutter_actor_get_x (actor));
|
|
|
|
break;
|
|
|
|
case PROP_Y:
|
|
|
|
g_value_set_int (value, clutter_actor_get_y (actor));
|
|
|
|
break;
|
|
|
|
case PROP_WIDTH:
|
|
|
|
g_value_set_int (value, clutter_actor_get_width (actor));
|
|
|
|
break;
|
|
|
|
case PROP_HEIGHT:
|
|
|
|
g_value_set_int (value, clutter_actor_get_height (actor));
|
|
|
|
break;
|
|
|
|
case PROP_OPACITY:
|
|
|
|
g_value_set_uchar (value, priv->opacity);
|
|
|
|
break;
|
|
|
|
case PROP_NAME:
|
|
|
|
g_value_set_string (value, priv->name);
|
|
|
|
break;
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
case PROP_VISIBLE:
|
|
|
|
g_value_set_boolean (value,
|
|
|
|
(CLUTTER_ACTOR_IS_VISIBLE (actor) != FALSE));
|
|
|
|
break;
|
2006-07-06 14:12:19 -04:00
|
|
|
case PROP_HAS_CLIP:
|
|
|
|
g_value_set_boolean (value, priv->has_clip);
|
|
|
|
break;
|
|
|
|
case PROP_CLIP:
|
|
|
|
g_value_set_boxed (value, &(priv->clip));
|
|
|
|
break;
|
2006-06-13 09:17:45 -04:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_actor_dispose (GObject *object)
|
|
|
|
{
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
ClutterActor *self = CLUTTER_ACTOR (object);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-11-22 15:52:27 -05:00
|
|
|
CLUTTER_NOTE (MISC, "Disposing of object (id=%d) of type `%s'",
|
|
|
|
self->priv->id,
|
|
|
|
g_type_name (G_OBJECT_TYPE (self)));
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
|
|
|
|
if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION))
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_DESTRUCTION);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_signal_emit (self, actor_signals[DESTROY], 0);
|
|
|
|
|
|
|
|
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_DESTRUCTION);
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
G_OBJECT_CLASS (clutter_actor_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_actor_finalize (GObject *object)
|
|
|
|
{
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
ClutterActor *actor = CLUTTER_ACTOR (object);
|
|
|
|
|
|
|
|
g_free (actor->priv->name);
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
G_OBJECT_CLASS (clutter_actor_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_actor_class_init (ClutterActorClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->set_property = clutter_actor_set_property;
|
|
|
|
object_class->get_property = clutter_actor_get_property;
|
|
|
|
object_class->dispose = clutter_actor_dispose;
|
|
|
|
object_class->finalize = clutter_actor_finalize;
|
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (ClutterActorPrivate));
|
|
|
|
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:x:
|
|
|
|
*
|
|
|
|
* X coordinate of the actor.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_X,
|
|
|
|
g_param_spec_int ("x",
|
|
|
|
"X co-ord",
|
|
|
|
"X co-ord of actor",
|
2006-12-13 04:44:05 -05:00
|
|
|
-G_MAXINT, G_MAXINT,
|
2006-11-20 07:02:24 -05:00
|
|
|
0,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:y:
|
|
|
|
*
|
|
|
|
* Y coordinate of the actor.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_Y,
|
|
|
|
g_param_spec_int ("y",
|
|
|
|
"Y co-ord",
|
|
|
|
"Y co-ord of actor",
|
2006-12-13 04:44:05 -05:00
|
|
|
-G_MAXINT, G_MAXINT,
|
2006-11-20 07:02:24 -05:00
|
|
|
0,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:width:
|
|
|
|
*
|
|
|
|
* Width of the actor (in pixels).
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_WIDTH,
|
|
|
|
g_param_spec_int ("width",
|
|
|
|
"Width",
|
|
|
|
"Width of actor in pixels",
|
|
|
|
0, G_MAXINT,
|
|
|
|
0,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:height:
|
|
|
|
*
|
|
|
|
* Height of the actor (in pixels).
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_HEIGHT,
|
|
|
|
g_param_spec_int ("height",
|
|
|
|
"Height",
|
|
|
|
"Height of actor in pixels",
|
|
|
|
0, G_MAXINT,
|
|
|
|
0,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:opacity:
|
|
|
|
*
|
|
|
|
* Opacity of the actor.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_OPACITY,
|
|
|
|
g_param_spec_uchar ("opacity",
|
|
|
|
"Opacity",
|
|
|
|
"Opacity of actor",
|
|
|
|
0, 0xff,
|
|
|
|
0xff,
|
2006-12-04 11:26:35 -05:00
|
|
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:visible:
|
|
|
|
*
|
|
|
|
* Whether the actor is visible or not.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_VISIBLE,
|
|
|
|
g_param_spec_boolean ("visible",
|
|
|
|
"Visible",
|
|
|
|
"Whether the actor is visible or not",
|
|
|
|
FALSE,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:has-clip:
|
|
|
|
*
|
|
|
|
* Whether the actor has the clip property set or not.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_HAS_CLIP,
|
|
|
|
g_param_spec_boolean ("has-clip",
|
|
|
|
"Has Clip",
|
|
|
|
"Whether the actor has a clip set or not",
|
|
|
|
FALSE,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READABLE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:clip:
|
|
|
|
*
|
|
|
|
* The clip region for the actor.
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_CLIP,
|
|
|
|
g_param_spec_boxed ("clip",
|
|
|
|
"Clip",
|
|
|
|
"The clip region for the actor",
|
|
|
|
CLUTTER_TYPE_GEOMETRY,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-11-20 07:02:24 -05:00
|
|
|
/**
|
|
|
|
* ClutterActor:name:
|
|
|
|
*
|
|
|
|
* The name of the actor.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_NAME,
|
|
|
|
g_param_spec_string ("name",
|
|
|
|
"Name",
|
|
|
|
"Name of the actor",
|
|
|
|
NULL,
|
2006-12-04 11:26:35 -05:00
|
|
|
CLUTTER_PARAM_READWRITE));
|
2006-07-06 14:12:19 -04:00
|
|
|
|
2006-07-06 14:55:46 -04:00
|
|
|
/**
|
|
|
|
* ClutterActor::destroy:
|
|
|
|
* @actor: the object which received the signal
|
|
|
|
*
|
|
|
|
* The ::destroy signal is emitted when an actor is destroyed,
|
|
|
|
* either by direct invocation of clutter_actor_destroy() or
|
|
|
|
* when the #ClutterGroup that contains the actor is destroyed.
|
|
|
|
*
|
2006-11-20 07:02:24 -05:00
|
|
|
* Since: 0.2
|
2006-07-06 14:55:46 -04:00
|
|
|
*/
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
actor_signals[DESTROY] =
|
|
|
|
g_signal_new ("destroy",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, destroy),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2006-07-06 14:55:46 -04:00
|
|
|
/**
|
|
|
|
* ClutterActor::show:
|
|
|
|
* @actor: the object which received the signal
|
|
|
|
*
|
|
|
|
* The ::show signal is emitted when an actor becomes visible.
|
|
|
|
*
|
2006-11-20 07:02:24 -05:00
|
|
|
* Since: 0.2
|
2006-07-06 14:55:46 -04:00
|
|
|
*/
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
actor_signals[SHOW] =
|
|
|
|
g_signal_new ("show",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, show),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2006-07-06 14:55:46 -04:00
|
|
|
/**
|
|
|
|
* ClutterActor::hide:
|
|
|
|
* @actor: the object which received the signal
|
|
|
|
*
|
|
|
|
* The ::hide signal is emitted when an actor is no longer visible.
|
|
|
|
*
|
2006-11-20 07:02:24 -05:00
|
|
|
* Since: 0.2
|
2006-07-06 14:55:46 -04:00
|
|
|
*/
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
actor_signals[HIDE] =
|
|
|
|
g_signal_new ("hide",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, hide),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
2006-11-20 07:02:24 -05:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
/**
|
|
|
|
* ClutterActor::parent-set:
|
|
|
|
* @actor: the object which received the signal
|
|
|
|
* @old_parent: the previous parent of the actor, or %NULL
|
|
|
|
*
|
|
|
|
* This signal is emitted when the parent of the actor changes.
|
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
actor_signals[PARENT_SET] =
|
|
|
|
g_signal_new ("parent-set",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, parent_set),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_ACTOR);
|
2006-12-12 15:20:04 -05:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
/**
|
|
|
|
* ClutterActor::event:
|
|
|
|
* @actor: the actor which received the event
|
|
|
|
* @event: a #ClutterEvent
|
|
|
|
*
|
|
|
|
* The ::event signal is emitted each time and event is received
|
|
|
|
* by the @actor.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[EVENT] =
|
|
|
|
g_signal_new ("event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 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),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, event_after),
|
|
|
|
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
|
|
|
|
* @event: a #ClutterButtonEvent
|
|
|
|
*
|
|
|
|
* The ::button-press-event signal is emitted each time a mouse button
|
|
|
|
* is pressed on @actor.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[BUTTON_PRESS_EVENT] =
|
|
|
|
g_signal_new ("button-press-event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, button_press_event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
/**
|
|
|
|
* ClutterActor::button-release-event:
|
|
|
|
* @actor: the actor which received the event
|
|
|
|
* @event: a #ClutterButtonEvent
|
|
|
|
*
|
|
|
|
* The ::button-release-event signal is emitted each time a mouse button
|
|
|
|
* is released on @actor.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[BUTTON_RELEASE_EVENT] =
|
|
|
|
g_signal_new ("button-release-event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, button_release_event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
/**
|
|
|
|
* ClutterActor::scroll-event:
|
|
|
|
* @actor: the actor which received the event
|
|
|
|
* @event: a #ClutterScrollEvent
|
|
|
|
*
|
|
|
|
* The ::scroll-event signal is emitted each time a the mouse is
|
|
|
|
* scrolled on @actor
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[SCROLL_EVENT] =
|
|
|
|
g_signal_new ("scroll-event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, scroll_event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
/**
|
|
|
|
* ClutterActor::key-press-event:
|
|
|
|
* @actor: the actor which received the event
|
|
|
|
* @event: a #ClutterKeyEvent
|
|
|
|
*
|
|
|
|
* The ::key-press-event signal is emitted each time a keyboard button
|
|
|
|
* is pressed on @actor.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[KEY_PRESS_EVENT] =
|
|
|
|
g_signal_new ("key-press-event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, key_press_event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
/**
|
|
|
|
* ClutterActor::key-release-event:
|
|
|
|
* @actor: the actor which received the event
|
|
|
|
* @event: a #ClutterKeyEvent
|
|
|
|
*
|
|
|
|
* The ::key-release-event signal is emitted each time a keyboard button
|
|
|
|
* is released on @actor.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[KEY_RELEASE_EVENT] =
|
|
|
|
g_signal_new ("key-release-event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, key_release_event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
/**
|
|
|
|
* ClutterActor::motion-event:
|
|
|
|
* @actor: the actor which received the event
|
|
|
|
* @event: a #ClutterMotionEvent
|
|
|
|
*
|
|
|
|
* The ::motion-event signal is emitted each time the mouse pointer is
|
|
|
|
* moved on @actor.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[MOTION_EVENT] =
|
|
|
|
g_signal_new ("motion-event",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, motion_event),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__BOXED,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterActor::focus-in:
|
|
|
|
* @actor: the actor which now has key focus
|
|
|
|
*
|
|
|
|
* The ::focus-in signal is emitted when @actor recieves key focus.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[FOCUS_IN] =
|
|
|
|
g_signal_new ("focus-in",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, focus_in),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterActor::focus-out:
|
|
|
|
* @actor: the actor which now has key focus
|
|
|
|
*
|
|
|
|
* The ::focus-out signal is emitted when @actor loses key focus.
|
|
|
|
*
|
|
|
|
* Source: 0.6
|
|
|
|
*/
|
|
|
|
actor_signals[FOCUS_OUT] =
|
|
|
|
g_signal_new ("focus-out",
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (ClutterActorClass, focus_out),
|
|
|
|
NULL, NULL,
|
|
|
|
clutter_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
|
|
|
|
2006-12-12 15:20:04 -05:00
|
|
|
klass->show = clutter_actor_real_show;
|
|
|
|
klass->show_all = clutter_actor_show;
|
|
|
|
klass->hide = clutter_actor_real_hide;
|
|
|
|
klass->hide_all = clutter_actor_hide;
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_actor_init (ClutterActor *self)
|
|
|
|
{
|
|
|
|
self->priv = CLUTTER_ACTOR_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
self->priv->parent_actor = NULL;
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
self->priv->has_clip = FALSE;
|
|
|
|
self->priv->opacity = 0xff;
|
|
|
|
self->priv->id = __id++;
|
2006-08-29 15:09:43 -04:00
|
|
|
self->priv->scale_x = CFX_ONE;
|
|
|
|
self->priv->scale_y = CFX_ONE;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
clutter_actor_set_position (self, 0, 0);
|
|
|
|
clutter_actor_set_size (self, 0, 0);
|
|
|
|
}
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_destroy:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Destroys an actor. When an actor is destroyed, it will break any
|
|
|
|
* references it holds to other objects. If the actor is inside a
|
2007-08-13 13:01:07 -04:00
|
|
|
* container, the actor will be removed.
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
*
|
2007-08-13 13:01:07 -04:00
|
|
|
* When you destroy a container its children will be destroyed as well.
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_destroy (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION))
|
|
|
|
g_object_run_dispose (G_OBJECT (self));
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_queue_redraw:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Queues up a redraw of an actor and any children. The redraw occurs
|
|
|
|
* once the main loop becomes idle (after the current batch of events
|
|
|
|
* has been processed, roughly).
|
|
|
|
*
|
|
|
|
* Applications rarely need to call this as redraws are handled automatically
|
|
|
|
* by modification functions.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_queue_redraw (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterMainContext *ctx = CLUTTER_CONTEXT();
|
|
|
|
|
|
|
|
if (!ctx->update_idle)
|
|
|
|
{
|
2007-08-08 06:20:14 -04:00
|
|
|
CLUTTER_TIMESTAMP (SCHEDULER, "Adding idle source for actor: %p", self);
|
|
|
|
|
|
|
|
ctx->update_idle =
|
|
|
|
clutter_threads_add_idle_full (G_PRIORITY_DEFAULT + 10,
|
|
|
|
redraw_update_idle,
|
|
|
|
NULL, NULL);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_geometry:
|
|
|
|
* @self: A #ClutterActor
|
2006-07-06 14:55:46 -04:00
|
|
|
* @geometry: A #ClutterGeometry
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Sets the actors untransformed geometry in pixels relative to any
|
|
|
|
* parent actor.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
clutter_actor_set_geometry (ClutterActor *self,
|
2006-07-06 14:55:46 -04:00
|
|
|
const ClutterGeometry *geometry)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
box.x1 = CLUTTER_UNITS_FROM_INT (geometry->x);
|
|
|
|
box.y1 = CLUTTER_UNITS_FROM_INT (geometry->y);
|
|
|
|
box.x2 = CLUTTER_UNITS_FROM_INT (geometry->x + geometry->width);
|
|
|
|
box.y2 = CLUTTER_UNITS_FROM_INT (geometry->y + geometry->height);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
clutter_actor_request_coords (self, &box);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_geometry:
|
|
|
|
* @self: A #ClutterActor
|
2006-07-06 14:55:46 -04:00
|
|
|
* @geometry: A location to store actors #ClutterGeometry
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Gets the actors untransformed geometry in pixels relative to any
|
|
|
|
* parent actor.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
clutter_actor_get_geometry (ClutterActor *self,
|
2006-07-06 14:55:46 -04:00
|
|
|
ClutterGeometry *geometry)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
geometry->x = CLUTTER_UNITS_TO_INT (box.x1);
|
|
|
|
geometry->y = CLUTTER_UNITS_TO_INT (box.y1);
|
|
|
|
geometry->width = CLUTTER_UNITS_TO_INT (box.x2 - box.x1);
|
|
|
|
geometry->height = CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_coords:
|
|
|
|
* @self: A #ClutterActor
|
2007-07-26 07:04:04 -04:00
|
|
|
* @x_1: A location to store actors left position, or %NULL.
|
|
|
|
* @y_1: A location to store actors top position, or %NULL.
|
|
|
|
* @x_2: A location to store actors right position, or %NULL.
|
|
|
|
* @y_2: A location to store actors bottom position, or %NULL.
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Gets the actors untransformed bounding rectangle co-ordinates in pixels
|
2006-06-13 09:17:45 -04:00
|
|
|
* relative to any parent actor.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_get_coords (ClutterActor *self,
|
2007-07-26 07:04:04 -04:00
|
|
|
gint *x_1,
|
|
|
|
gint *y_1,
|
|
|
|
gint *x_2,
|
|
|
|
gint *y_2)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-05-22 05:31:40 -04:00
|
|
|
ClutterActorBox box;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-07-26 07:04:04 -04:00
|
|
|
if (x_1)
|
|
|
|
*x_1 = CLUTTER_UNITS_TO_INT (box.x1);
|
2006-11-20 07:02:24 -05:00
|
|
|
|
2007-07-26 07:04:04 -04:00
|
|
|
if (y_1)
|
|
|
|
*y_1 = CLUTTER_UNITS_TO_INT (box.y1);
|
2006-11-20 07:02:24 -05:00
|
|
|
|
2007-07-26 07:04:04 -04:00
|
|
|
if (x_2)
|
|
|
|
*x_2 = CLUTTER_UNITS_TO_INT (box.x2);
|
2006-11-20 07:02:24 -05:00
|
|
|
|
2007-07-26 07:04:04 -04:00
|
|
|
if (y_2)
|
|
|
|
*y_2 = CLUTTER_UNITS_TO_INT (box.y2);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_position
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @x: New left position of actor in pixels.
|
|
|
|
* @y: New top position of actor in pixels.
|
|
|
|
*
|
|
|
|
* Sets the actors position in pixels relative to any
|
|
|
|
* parent actor.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_position (ClutterActor *self,
|
2006-11-20 07:02:24 -05:00
|
|
|
gint x,
|
|
|
|
gint y)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-05-22 05:31:40 -04:00
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2007-05-22 05:31:40 -04:00
|
|
|
|
|
|
|
box.x2 += (CLUTTER_UNITS_FROM_INT (x) - box.x1);
|
|
|
|
box.y2 += (CLUTTER_UNITS_FROM_INT (y) - box.y1);
|
|
|
|
|
|
|
|
box.x1 = CLUTTER_UNITS_FROM_INT (x);
|
|
|
|
box.y1 = CLUTTER_UNITS_FROM_INT (y);
|
|
|
|
|
|
|
|
clutter_actor_request_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2006-11-15 16:19:01 -05:00
|
|
|
/**
|
|
|
|
* clutter_actor_move_by
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @dx: Distance to move Actor on X axis.
|
|
|
|
* @dy: Distance to move Actor on Y axis.
|
|
|
|
*
|
|
|
|
* Moves an actor by specified distance relative to
|
2007-06-22 11:16:40 -04:00
|
|
|
* current position in pixels.
|
2006-11-15 16:19:01 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_move_by (ClutterActor *self,
|
|
|
|
gint dx,
|
|
|
|
gint dy)
|
|
|
|
{
|
2007-05-22 05:31:40 -04:00
|
|
|
ClutterActorBox box;
|
|
|
|
gint32 dxu = CLUTTER_UNITS_FROM_INT (dx);
|
|
|
|
gint32 dyu = CLUTTER_UNITS_FROM_INT (dy);
|
2007-05-18 03:30:06 -04:00
|
|
|
|
2006-11-15 16:19:01 -05:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
box.x2 += dxu;
|
|
|
|
box.y2 += dyu;
|
|
|
|
box.x1 += dxu;
|
|
|
|
box.y1 += dyu;
|
2006-11-15 16:19:01 -05:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
clutter_actor_request_coords (self, &box);
|
2006-11-15 16:19:01 -05:00
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_set_size
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @width: New width of actor in pixels
|
|
|
|
* @height: New height of actor in pixels
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Sets the actors size in pixels.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_size (ClutterActor *self,
|
2006-11-20 07:02:24 -05:00
|
|
|
gint width,
|
|
|
|
gint height)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-05-22 05:31:40 -04:00
|
|
|
ClutterActorBox box;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
box.x2 = box.x1 + CLUTTER_UNITS_FROM_INT (width);
|
|
|
|
box.y2 = box.y1 + CLUTTER_UNITS_FROM_INT (height);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
clutter_actor_request_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2006-12-13 13:12:09 -05:00
|
|
|
/**
|
2006-12-12 15:20:04 -05:00
|
|
|
* clutter_actor_get_size:
|
2006-11-15 16:19:01 -05:00
|
|
|
* @self: A #ClutterActor
|
2006-11-17 13:45:31 -05:00
|
|
|
* @width: Location to store width if non NULL.
|
|
|
|
* @height: Location to store height if non NULL.
|
2006-11-15 16:19:01 -05:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Gets the size of an actor in pixels ignoring any scaling factors.
|
2006-11-15 16:19:01 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_get_size (ClutterActor *self,
|
|
|
|
guint *width,
|
|
|
|
guint *height)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
if (width)
|
2006-11-20 07:02:24 -05:00
|
|
|
*width = clutter_actor_get_width (self);
|
|
|
|
|
2006-11-15 16:19:01 -05:00
|
|
|
if (height)
|
2006-11-20 07:02:24 -05:00
|
|
|
*height = clutter_actor_get_height (self);
|
2006-11-15 16:19:01 -05:00
|
|
|
}
|
|
|
|
|
2007-05-23 06:47:35 -04:00
|
|
|
/*
|
2007-05-22 05:31:40 -04:00
|
|
|
* clutter_actor_get_abs_position_units
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @x: Location to store x position if non NULL.
|
|
|
|
* @y: Location to store y position if non NULL.
|
|
|
|
*
|
|
|
|
* Gets the absolute position of an actor in clutter units relative
|
|
|
|
* to the stage.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-05-23 06:47:35 -04:00
|
|
|
static void
|
2007-05-22 05:31:40 -04:00
|
|
|
clutter_actor_get_abs_position_units (ClutterActor *self,
|
|
|
|
gint32 *x,
|
|
|
|
gint32 *y)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-07-02 05:21:58 -04:00
|
|
|
ClutterVertex v1;
|
|
|
|
ClutterVertex v2;
|
2007-07-28 13:11:39 -04:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-07-02 05:21:58 -04:00
|
|
|
v1.x = v1.y = v1.z = 0;
|
|
|
|
clutter_actor_apply_transform_to_point (self, &v1, &v2);
|
|
|
|
|
2007-07-28 13:11:39 -04:00
|
|
|
if (x)
|
|
|
|
*x = v2.x;
|
|
|
|
if (y)
|
|
|
|
*y = v2.y;
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-05-18 03:30:06 -04:00
|
|
|
/**
|
2007-05-23 06:47:35 -04:00
|
|
|
* clutter_actor_get_abs_position
|
2007-05-18 03:30:06 -04:00
|
|
|
* @self: A #ClutterActor
|
2007-05-23 06:47:35 -04:00
|
|
|
* @x: Location to store x position if non NULL.
|
|
|
|
* @y: Location to store y position if non NULL.
|
2007-05-18 03:30:06 -04:00
|
|
|
*
|
2007-05-23 06:47:35 -04:00
|
|
|
* Gets the absolute position of an actor in pixels relative
|
|
|
|
* to the stage.
|
2007-05-18 03:30:06 -04:00
|
|
|
*/
|
|
|
|
void
|
2007-05-23 06:47:35 -04:00
|
|
|
clutter_actor_get_abs_position (ClutterActor *self,
|
2007-07-28 13:11:39 -04:00
|
|
|
gint *x,
|
|
|
|
gint *y)
|
2007-05-18 03:30:06 -04:00
|
|
|
{
|
2007-07-28 13:11:39 -04:00
|
|
|
ClutterUnit xu, yu;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
xu = yu = 0;
|
2007-05-23 06:47:35 -04:00
|
|
|
clutter_actor_get_abs_position_units (self, &xu, &yu);
|
|
|
|
|
2007-07-28 13:11:39 -04:00
|
|
|
if (x)
|
|
|
|
*x = CLUTTER_UNITS_TO_INT (xu);
|
|
|
|
if (y)
|
|
|
|
*y = CLUTTER_UNITS_TO_INT (yu);
|
2007-05-18 03:30:06 -04:00
|
|
|
}
|
|
|
|
|
2007-05-23 06:47:35 -04:00
|
|
|
/*
|
2007-05-22 05:31:40 -04:00
|
|
|
* clutter_actor_get_abs_size_units:
|
2006-08-29 15:09:43 -04:00
|
|
|
* @self: A #ClutterActor
|
2006-12-12 15:20:04 -05:00
|
|
|
* @width: Location to store width if non NULL.
|
|
|
|
* @height: Location to store height if non NULL.
|
2006-08-29 15:09:43 -04:00
|
|
|
*
|
2007-05-22 05:31:40 -04:00
|
|
|
* Gets the absolute size of an actor in clutter units taking into account
|
|
|
|
* an scaling factors.
|
|
|
|
*
|
2007-06-14 04:17:13 -04:00
|
|
|
* Note: When the actor (or one of its ancestors) is rotated around the x or y
|
|
|
|
* axis, it no longer appears as on the stage as a rectangle, but as a generic
|
|
|
|
* quadrangle; in that case this function returns the size of the smallest
|
|
|
|
* rectangle that encapsulates the entire quad. Please note that in this case
|
|
|
|
* no assumptions can be made about the relative position of this envelope to
|
|
|
|
* the absolute position of the actor, as returned by
|
|
|
|
* clutter_actor_get_abs_position() - if you need this information, you need
|
2007-06-27 11:10:52 -04:00
|
|
|
* to use clutter_actor_get_vertices() to get the coords of the actual
|
2007-06-14 04:17:13 -04:00
|
|
|
* quadrangle.
|
|
|
|
*
|
2007-05-22 05:31:40 -04:00
|
|
|
* Since: 0.4
|
2006-08-29 15:09:43 -04:00
|
|
|
*/
|
2007-05-23 06:47:35 -04:00
|
|
|
static void
|
2007-05-22 05:31:40 -04:00
|
|
|
clutter_actor_get_abs_size_units (ClutterActor *self,
|
|
|
|
gint32 *width,
|
|
|
|
gint32 *height)
|
2006-08-29 15:09:43 -04:00
|
|
|
{
|
2007-06-14 04:17:13 -04:00
|
|
|
ClutterVertex v[4];
|
|
|
|
ClutterFixed x_min, x_max, y_min, y_max;
|
|
|
|
gint i;
|
|
|
|
|
2007-06-27 11:10:52 -04:00
|
|
|
clutter_actor_get_vertices (self, v);
|
2006-08-29 15:09:43 -04:00
|
|
|
|
2007-06-14 04:17:13 -04:00
|
|
|
x_min = x_max = v[0].x;
|
|
|
|
y_min = y_max = v[0].y;
|
2006-08-29 15:09:43 -04:00
|
|
|
|
2007-06-14 04:17:13 -04:00
|
|
|
for (i = 1; i < sizeof(v)/sizeof(v[0]); ++i)
|
2006-08-29 15:09:43 -04:00
|
|
|
{
|
2007-06-14 04:17:13 -04:00
|
|
|
if (v[i].x < x_min)
|
|
|
|
x_min = v[i].x;
|
|
|
|
|
|
|
|
if (v[i].x > x_max)
|
|
|
|
x_max = v[i].x;
|
|
|
|
|
|
|
|
if (v[i].y < y_min)
|
|
|
|
y_min = v[i].y;
|
|
|
|
|
|
|
|
if (v[i].y > y_max)
|
|
|
|
y_max = v[i].y;
|
2007-05-18 03:30:06 -04:00
|
|
|
}
|
2007-06-14 04:17:13 -04:00
|
|
|
|
|
|
|
*width = x_max - x_min;
|
|
|
|
*height = y_max - y_min;
|
2007-05-18 03:30:06 -04:00
|
|
|
}
|
|
|
|
|
2007-05-23 06:47:35 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_abs_size:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_get_abs_size (ClutterActor *self,
|
|
|
|
guint *width,
|
|
|
|
guint *height)
|
|
|
|
{
|
|
|
|
gint32 wu, hu;
|
|
|
|
clutter_actor_get_abs_size_units (self, &wu, &hu);
|
|
|
|
|
|
|
|
*width = CLUTTER_UNITS_TO_INT (wu);
|
|
|
|
*height = CLUTTER_UNITS_TO_INT (hu);
|
|
|
|
}
|
|
|
|
|
2006-08-29 15:09:43 -04:00
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_width
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Retrieves the actors width ignoring any scaling factors.
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
|
|
|
* Return value: The actor width in pixels
|
|
|
|
**/
|
|
|
|
guint
|
|
|
|
clutter_actor_get_width (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
return CLUTTER_UNITS_TO_INT (box.x2 - box.x1);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_height
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Retrieves the actors height ignoring any scaling factors.
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
|
|
|
* Return value: The actor height in pixels
|
|
|
|
**/
|
|
|
|
guint
|
|
|
|
clutter_actor_get_height (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
return CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-01-04 14:56:01 -05:00
|
|
|
/**
|
|
|
|
* clutter_actor_set_width
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @width: Requested new width for actor
|
|
|
|
*
|
|
|
|
* Requests a new width for actor
|
|
|
|
*
|
|
|
|
* since: 2.0
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_set_width (ClutterActor *self, guint width)
|
|
|
|
{
|
|
|
|
clutter_actor_set_size (self,
|
|
|
|
width,
|
|
|
|
clutter_actor_get_height (self));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_height
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @height: Requested new height for actor
|
|
|
|
*
|
|
|
|
* Requests a new height for actor
|
|
|
|
*
|
|
|
|
* since: 2.0
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
clutter_actor_set_height (ClutterActor *self, guint height)
|
|
|
|
{
|
|
|
|
clutter_actor_set_size (self,
|
|
|
|
clutter_actor_get_width (self),
|
|
|
|
height);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_x
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Retrieves the actors x position relative to any parent.
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Return value: The actor x position in pixels ignoring any tranforms
|
|
|
|
* (i.e scaling, rotation).
|
2006-06-13 09:17:45 -04:00
|
|
|
**/
|
|
|
|
gint
|
|
|
|
clutter_actor_get_x (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
return CLUTTER_UNITS_TO_INT (box.x1);
|
2007-05-18 03:30:06 -04:00
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_y:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Retrieves the actors y position relative to any parent.
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Return value: The actor y position in pixels ignoring any tranforms
|
|
|
|
* (i.e scaling, rotation).
|
2006-06-13 09:17:45 -04:00
|
|
|
**/
|
|
|
|
gint
|
|
|
|
clutter_actor_get_y (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActorBox box;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
return CLUTTER_UNITS_TO_INT (box.y1);
|
2007-05-18 03:30:06 -04:00
|
|
|
}
|
|
|
|
|
2006-08-29 15:09:43 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_set_scalex:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @scale_x: #ClutterFixed factor to scale actor by horizontally.
|
|
|
|
* @scale_y: #ClutterFixed factor to scale actor by vertically.
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Scales an actor with fixed point parameters.
|
2006-08-29 15:09:43 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_scalex (ClutterActor *self,
|
|
|
|
ClutterFixed scale_x,
|
|
|
|
ClutterFixed scale_y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
self->priv->scale_x = scale_x;
|
|
|
|
self->priv->scale_y = scale_y;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_scale:
|
|
|
|
* @self: A #ClutterActor
|
2007-06-22 11:16:40 -04:00
|
|
|
* @scale_x: double factor to scale actor by horizontally.
|
|
|
|
* @scale_y: double factor to scale actor by vertically.
|
2006-12-13 13:12:09 -05:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Scales an actor with floating point parameters.
|
2006-12-13 13:12:09 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-08-29 15:09:43 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_scale (ClutterActor *self,
|
|
|
|
double scale_x,
|
|
|
|
double scale_y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
clutter_actor_set_scalex (self,
|
|
|
|
CLUTTER_FLOAT_TO_FIXED (scale_x),
|
|
|
|
CLUTTER_FLOAT_TO_FIXED (scale_y));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-12-12 15:20:04 -05:00
|
|
|
* clutter_actor_get_scalex:
|
2006-08-29 15:09:43 -04:00
|
|
|
* @self: A #ClutterActor
|
2007-06-22 11:16:40 -04:00
|
|
|
* @scale_x: Location to store horizonal fixed scale factor if non NULL.
|
|
|
|
* @scale_y: Location to store vertical fixed scale factor if non NULL.
|
2006-08-29 15:09:43 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Retrieves an actors scale in fixed point.
|
2006-12-12 15:20:04 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-08-29 15:09:43 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_get_scalex (ClutterActor *self,
|
|
|
|
ClutterFixed *scale_x,
|
|
|
|
ClutterFixed *scale_y)
|
|
|
|
{
|
|
|
|
if (scale_x)
|
|
|
|
*scale_x = self->priv->scale_x;
|
|
|
|
|
|
|
|
if (scale_y)
|
|
|
|
*scale_y = self->priv->scale_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-12-12 15:20:04 -05:00
|
|
|
* clutter_actor_get_scale:
|
2006-08-29 15:09:43 -04:00
|
|
|
* @self: A #ClutterActor
|
2007-06-22 11:16:40 -04:00
|
|
|
* @scale_x: Location to store horizonal float scale factor if non NULL.
|
|
|
|
* @scale_y: Location to store vertical float scale factor if non NULL.
|
2006-08-29 15:09:43 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Retrieves an actors scale in floating point.
|
2006-12-12 15:20:04 -05:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2006-08-29 15:09:43 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_get_scale (ClutterActor *self,
|
2006-11-20 07:02:24 -05:00
|
|
|
gdouble *scale_x,
|
|
|
|
gdouble *scale_y)
|
2006-08-29 15:09:43 -04:00
|
|
|
{
|
|
|
|
if (scale_x)
|
2006-11-20 07:02:24 -05:00
|
|
|
*scale_x = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_x);
|
2006-08-29 15:09:43 -04:00
|
|
|
|
|
|
|
if (scale_y)
|
2006-11-20 07:02:24 -05:00
|
|
|
*scale_y = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_y);
|
2006-08-29 15:09:43 -04:00
|
|
|
}
|
|
|
|
|
2007-05-18 03:30:06 -04:00
|
|
|
/**
|
2007-05-25 08:07:24 -04:00
|
|
|
* clutter_actor_set_scale_with_gravity:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @scale_x: scaling factor for x axis
|
|
|
|
* @scale_y: scaling factor for y axis
|
|
|
|
* @gravity: #ClutterGravity to apply to scaling.
|
|
|
|
*
|
|
|
|
* Scales the actor by scale_x, scale_y taking into consideration the
|
|
|
|
* required gravity.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_scale_with_gravity (ClutterActor *self,
|
2007-06-22 11:16:40 -04:00
|
|
|
gfloat scale_x,
|
|
|
|
gfloat scale_y,
|
|
|
|
ClutterGravity gravity)
|
2007-05-25 08:07:24 -04:00
|
|
|
{
|
2007-06-22 11:16:40 -04:00
|
|
|
clutter_actor_set_scale_with_gravityx (self,
|
|
|
|
CLUTTER_FLOAT_TO_FIXED (scale_x),
|
|
|
|
CLUTTER_FLOAT_TO_FIXED (scale_y),
|
|
|
|
gravity);
|
2007-05-25 08:07:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_scale_with_gravityx:
|
2007-05-18 03:30:06 -04:00
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @scale_x: #ClutterFixed scaling factor for x axis
|
|
|
|
* @scale_y: #ClutterFixed scaling factor for y axis
|
|
|
|
* @gravity: #ClutterGravity to apply to scaling.
|
|
|
|
*
|
|
|
|
* Scales the actor by scale_x, scale_y taking into consideration the
|
|
|
|
* required gravity.
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
void
|
2007-05-25 08:07:24 -04:00
|
|
|
clutter_actor_set_scale_with_gravityx (ClutterActor *self,
|
|
|
|
ClutterFixed scale_x,
|
|
|
|
ClutterFixed scale_y,
|
|
|
|
ClutterGravity gravity)
|
2007-05-18 03:30:06 -04:00
|
|
|
{
|
2007-05-22 05:31:40 -04:00
|
|
|
ClutterActorBox box;
|
2007-06-27 05:41:49 -04:00
|
|
|
ClutterFixed sw, sh, w, h, x, y;
|
|
|
|
ClutterFixed old_scale_x, old_scale_y;
|
2007-05-18 03:30:06 -04:00
|
|
|
|
2007-06-27 05:41:49 -04:00
|
|
|
clutter_actor_get_scalex (self, &old_scale_x, &old_scale_y);
|
2007-05-18 03:30:06 -04:00
|
|
|
clutter_actor_set_scalex (self, scale_x, scale_y);
|
|
|
|
|
|
|
|
if (gravity == CLUTTER_GRAVITY_NONE ||
|
|
|
|
gravity == CLUTTER_GRAVITY_NORTH_WEST)
|
|
|
|
return;
|
|
|
|
|
2007-06-13 19:24:59 -04:00
|
|
|
clutter_actor_query_coords (self, &box);
|
2007-06-27 05:41:49 -04:00
|
|
|
|
|
|
|
w = CFX_MUL (box.x2 - box.x1, old_scale_x);
|
|
|
|
h = CFX_MUL (box.y2 - box.y1, old_scale_y);
|
|
|
|
sw = CFX_MUL (box.x2 - box.x1, scale_x);
|
|
|
|
sh = CFX_MUL (box.y2 - box.y1, scale_y);
|
|
|
|
|
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
x = box.x1;
|
|
|
|
y = box.y1;
|
|
|
|
|
2007-05-18 03:30:06 -04:00
|
|
|
switch (gravity)
|
|
|
|
{
|
|
|
|
case CLUTTER_GRAVITY_NORTH:
|
|
|
|
x = x - ((sw - w) / 2);
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_NORTH_EAST:
|
|
|
|
x = x + w - sw;
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_EAST:
|
|
|
|
x = x + w - sw;
|
|
|
|
y = y - ((sh - h) / 2);
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_SOUTH_EAST:
|
|
|
|
x = x + w - sw;
|
|
|
|
y = y + h - sh;
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_SOUTH:
|
|
|
|
x = x - ((sw - w) / 2);
|
|
|
|
y = y + h - sh;
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_SOUTH_WEST:
|
|
|
|
y = y + h - sh;
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_WEST:
|
|
|
|
y = y - ((sh - h) / 2);
|
|
|
|
break;
|
|
|
|
case CLUTTER_GRAVITY_CENTER:
|
|
|
|
x = x - ((sw - w) / 2);
|
|
|
|
y = y - ((sh - h) / 2);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-05-22 05:31:40 -04:00
|
|
|
box.x2 += (x - box.x1);
|
|
|
|
box.y2 += (y - box.y1);
|
|
|
|
box.x1 = x;
|
|
|
|
box.y1 = y;
|
|
|
|
|
|
|
|
clutter_actor_request_coords (self, &box);
|
2007-05-18 03:30:06 -04:00
|
|
|
}
|
2006-08-29 15:09:43 -04:00
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_set_opacity:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @opacity: New opacity value for actor.
|
|
|
|
*
|
|
|
|
* Sets the actors opacity, with zero being completely transparent.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_opacity (ClutterActor *self,
|
2007-05-22 05:31:40 -04:00
|
|
|
guint8 opacity)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
self->priv->opacity = opacity;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_opacity:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Retrieves the actors opacity.
|
|
|
|
*
|
|
|
|
* Return value: The actor opacity value.
|
|
|
|
*/
|
|
|
|
guint8
|
|
|
|
clutter_actor_get_opacity (ClutterActor *self)
|
|
|
|
{
|
|
|
|
ClutterActor *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
|
|
|
|
parent = self->priv->parent_actor;
|
|
|
|
|
2007-01-04 14:56:01 -05:00
|
|
|
/* Factor in the actual actors opacity with parents */
|
2006-06-13 09:17:45 -04:00
|
|
|
if (parent && clutter_actor_get_opacity (parent) != 0xff)
|
2007-01-06 19:36:41 -05:00
|
|
|
return (clutter_actor_get_opacity(parent) * self->priv->opacity) / 0xff;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
return self->priv->opacity;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_name:
|
|
|
|
* @self: A #ClutterActor
|
2006-07-06 14:55:46 -04:00
|
|
|
* @name: Textual tag to apply to actor
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
|
|
|
* Sets a textual tag to the actor.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_name (ClutterActor *self,
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
const gchar *name)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2006-11-20 07:02:24 -05:00
|
|
|
g_object_ref (self);
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_free (self->priv->name);
|
|
|
|
|
2006-11-20 07:02:24 -05:00
|
|
|
if (name && name[0] != '\0')
|
|
|
|
self->priv->name = g_strdup(name);
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "name");
|
|
|
|
g_object_unref (self);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_name:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2006-06-22 09:05:45 -04:00
|
|
|
* Retrieves the name of @self.
|
|
|
|
*
|
2006-06-13 09:17:45 -04:00
|
|
|
* Return value: pointer to textual tag for the actor. The
|
|
|
|
* returned string is owned by the actor and should not
|
|
|
|
* be modified or freed.
|
|
|
|
*/
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
G_CONST_RETURN gchar *
|
2006-06-13 09:17:45 -04:00
|
|
|
clutter_actor_get_name (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
|
|
|
|
|
|
|
|
return self->priv->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_id:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2006-06-21 19:02:20 -04:00
|
|
|
* Retrieves the unique id for @self.
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
|
|
|
* Return value: Globally unique value for object instance.
|
|
|
|
*/
|
|
|
|
guint32
|
|
|
|
clutter_actor_get_id (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
|
|
|
|
return self->priv->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_set_depth:
|
|
|
|
* @self: a #ClutterActor
|
2006-06-21 19:02:20 -04:00
|
|
|
* @depth: Z co-ord
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Sets the Z co-ordinate of @self to @depth. The Units of which are dependant
|
|
|
|
* on the perspective setup.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_depth (ClutterActor *self,
|
2006-11-20 07:02:24 -05:00
|
|
|
gint depth)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2006-12-12 15:20:04 -05:00
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/* Sets Z value. - FIXME: should invert ?*/
|
2006-12-12 15:20:04 -05:00
|
|
|
priv->z = depth;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-08-13 13:01:07 -04:00
|
|
|
if (priv->parent_actor && CLUTTER_IS_CONTAINER (priv->parent_actor))
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-08-13 13:01:07 -04:00
|
|
|
/* We need to resort the container stacking order as to
|
2006-06-13 09:17:45 -04:00
|
|
|
* correctly render alpha values.
|
|
|
|
*
|
|
|
|
* FIXME: This is sub optimal. maybe queue the the sort
|
|
|
|
* before stacking
|
|
|
|
*/
|
2007-08-13 13:01:07 -04:00
|
|
|
clutter_container_sort_depth_order (CLUTTER_CONTAINER (priv->parent_actor));
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
2007-08-04 03:55:55 -04:00
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_depth:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Retrieves the depth of @self.
|
|
|
|
*
|
|
|
|
* Return value: the depth of a #ClutterActor
|
|
|
|
*/
|
|
|
|
gint
|
|
|
|
clutter_actor_get_depth (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), -1);
|
|
|
|
|
|
|
|
return self->priv->z;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_rotate_z:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @angle: Angle of rotation
|
|
|
|
* @x: X co-ord to rotate actor around ( relative to actor position )
|
|
|
|
* @y: Y co-ord to rotate actor around ( relative to actor position )
|
|
|
|
*
|
|
|
|
* Rotates actor around the Z axis.
|
|
|
|
*/
|
|
|
|
void
|
2006-11-20 07:02:24 -05:00
|
|
|
clutter_actor_rotate_z (ClutterActor *self,
|
|
|
|
gfloat angle,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-04-27 17:13:06 -04:00
|
|
|
self->priv->rzang = CLUTTER_FLOAT_TO_FIXED (angle);
|
2006-06-13 09:17:45 -04:00
|
|
|
self->priv->rzx = x;
|
|
|
|
self->priv->rzy = y;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_rotate_x:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @angle: Angle of rotation
|
|
|
|
* @y: Y co-ord to rotate actor around ( relative to actor position )
|
|
|
|
* @z: Z co-ord to rotate actor around ( relative to actor position )
|
|
|
|
*
|
|
|
|
* Rotates actor around the X axis.
|
|
|
|
*/
|
|
|
|
void
|
2006-11-20 07:02:24 -05:00
|
|
|
clutter_actor_rotate_x (ClutterActor *self,
|
|
|
|
gfloat angle,
|
|
|
|
gint y,
|
|
|
|
gint z)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2007-04-27 17:13:06 -04:00
|
|
|
self->priv->rxang = CLUTTER_FLOAT_TO_FIXED(angle);
|
2006-06-13 09:17:45 -04:00
|
|
|
self->priv->rxy = y;
|
|
|
|
self->priv->rxz = z;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_rotate_y:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @angle: Angle of rotation
|
|
|
|
* @x: X co-ord to rotate actor around ( relative to actor position )
|
|
|
|
* @z: Z co-ord to rotate actor around ( relative to actor position )
|
|
|
|
*
|
|
|
|
* Rotates actor around the X axis.
|
|
|
|
*/
|
|
|
|
void
|
2006-11-20 07:02:24 -05:00
|
|
|
clutter_actor_rotate_y (ClutterActor *self,
|
|
|
|
gfloat angle,
|
|
|
|
gint x,
|
|
|
|
gint z)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
2007-04-27 17:13:06 -04:00
|
|
|
|
|
|
|
self->priv->ryang = CLUTTER_FLOAT_TO_FIXED(angle);
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
self->priv->ryx = x;
|
|
|
|
self->priv->ryz = z;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
2007-06-26 07:35:33 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_rotate_zx:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @angle: Angle of rotation
|
|
|
|
* @x: X co-ord to rotate actor around ( relative to actor position )
|
|
|
|
* @y: Y co-ord to rotate actor around ( relative to actor position )
|
|
|
|
*
|
|
|
|
* Rotates actor around the Z axis.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_rotate_zx (ClutterActor *self,
|
|
|
|
ClutterFixed angle,
|
|
|
|
gint x,
|
|
|
|
gint y)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
self->priv->rzang = angle;
|
|
|
|
self->priv->rzx = x;
|
|
|
|
self->priv->rzy = y;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_rotate_xx:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @angle: Angle of rotation
|
|
|
|
* @y: Y co-ord to rotate actor around ( relative to actor position )
|
|
|
|
* @z: Z co-ord to rotate actor around ( relative to actor position )
|
|
|
|
*
|
|
|
|
* Rotates actor around the X axis.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_rotate_xx (ClutterActor *self,
|
|
|
|
ClutterFixed angle,
|
|
|
|
gint y,
|
|
|
|
gint z)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
self->priv->rxang = angle;
|
|
|
|
self->priv->rxy = y;
|
|
|
|
self->priv->rxz = z;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_rotate_yx:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @angle: Angle of rotation
|
|
|
|
* @x: X co-ord to rotate actor around ( relative to actor position )
|
|
|
|
* @z: Z co-ord to rotate actor around ( relative to actor position )
|
|
|
|
*
|
|
|
|
* Rotates actor around the X axis.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_rotate_yx (ClutterActor *self,
|
|
|
|
ClutterFixed angle,
|
|
|
|
gint x,
|
|
|
|
gint z)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
self->priv->ryang = angle;
|
|
|
|
self->priv->ryx = x;
|
|
|
|
self->priv->ryz = z;
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self))
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_rxangx:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2007-08-01 09:11:43 -04:00
|
|
|
* Gets the angle of rotation around the X axis.
|
2007-07-24 13:34:06 -04:00
|
|
|
*
|
|
|
|
* Returns: the angle or rotation, as a fixed point value
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
2007-06-26 07:35:33 -04:00
|
|
|
*/
|
|
|
|
ClutterFixed
|
|
|
|
clutter_actor_get_rxangx (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
2007-07-24 13:34:06 -04:00
|
|
|
|
2007-06-26 07:35:33 -04:00
|
|
|
return self->priv->rxang;
|
|
|
|
}
|
|
|
|
|
2007-08-01 09:11:43 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_rxang:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Gets the angle of rotation around the X axis.
|
|
|
|
*
|
|
|
|
* Return value: the angle of rotation
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gdouble
|
|
|
|
clutter_actor_get_rxang (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.);
|
|
|
|
|
|
|
|
return CLUTTER_FIXED_TO_FLOAT (self->priv->rxang);
|
|
|
|
}
|
|
|
|
|
2007-06-26 07:35:33 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_ryangx:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2007-08-01 09:11:43 -04:00
|
|
|
* Gets the angle of rotation around the Y axis.
|
2007-07-24 13:34:06 -04:00
|
|
|
*
|
|
|
|
* Return value: the angle of rotation, as a fixed point value
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
2007-06-26 07:35:33 -04:00
|
|
|
*/
|
|
|
|
ClutterFixed
|
|
|
|
clutter_actor_get_ryangx (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
2007-08-01 09:11:43 -04:00
|
|
|
|
2007-06-26 07:35:33 -04:00
|
|
|
return self->priv->ryang;
|
|
|
|
}
|
|
|
|
|
2007-08-01 09:11:43 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_ryang:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Gets the angle of rotation around the Y axis.
|
|
|
|
*
|
|
|
|
* Return value: the angle of rotation
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gdouble
|
|
|
|
clutter_actor_get_ryang (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.);
|
|
|
|
|
|
|
|
return CLUTTER_FIXED_TO_FLOAT (self->priv->ryang);
|
|
|
|
}
|
|
|
|
|
2007-06-26 07:35:33 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_rzangx:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Gets the angle of rotation around x axis in degrees.
|
2007-07-24 13:34:06 -04:00
|
|
|
*
|
|
|
|
* Return value: the angle of rotation, as a fixed point value
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
2007-06-26 07:35:33 -04:00
|
|
|
*/
|
|
|
|
ClutterFixed
|
|
|
|
clutter_actor_get_rzangx (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
|
|
|
return self->priv->rzang;
|
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2007-08-01 09:11:43 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_get_rzang:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Gets the angle of rotation around the Z axis.
|
|
|
|
*
|
|
|
|
* Return value: the angle of rotation
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
gdouble
|
|
|
|
clutter_actor_get_rzang (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0.);
|
|
|
|
|
|
|
|
return CLUTTER_FIXED_TO_FLOAT (self->priv->rzang);
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_set_clip:
|
|
|
|
* @self: A #ClutterActor
|
2006-06-21 19:02:20 -04:00
|
|
|
* @xoff: X offset of the clip rectangle
|
|
|
|
* @yoff: Y offset of the clip rectangle
|
|
|
|
* @width: Width of the clip rectangle
|
|
|
|
* @height: Height of the clip rectangle
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Sets clip area in pixels for @self.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_clip (ClutterActor *self,
|
2006-07-06 14:12:19 -04:00
|
|
|
gint xoff,
|
|
|
|
gint yoff,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
ClutterGeometry *clip;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
clip = &(self->priv->clip);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
clip->x = xoff;
|
|
|
|
clip->y = yoff;
|
|
|
|
clip->width = width;
|
|
|
|
clip->height = height;
|
|
|
|
|
|
|
|
self->priv->has_clip = TRUE;
|
2006-07-06 14:12:19 -04:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "has-clip");
|
|
|
|
g_object_notify (G_OBJECT (self), "clip");
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_remove_clip
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* Removes clip area in pixels from @self.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_remove_clip (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
self->priv->has_clip = FALSE;
|
2006-07-06 14:12:19 -04:00
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), "has-clip");
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2006-07-06 14:12:19 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_has_clip:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* Gets whether the actor has a clip set or not.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the actor has a clip set.
|
2006-07-06 14:55:46 -04:00
|
|
|
*
|
|
|
|
* Since: 0.1.1
|
2006-07-06 14:12:19 -04:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_actor_has_clip (ClutterActor *self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
|
|
|
|
|
|
|
return self->priv->has_clip;
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_set_parent:
|
|
|
|
* @self: A #ClutterActor
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
* @parent: A new #ClutterActor parent
|
2006-06-13 09:17:45 -04:00
|
|
|
*
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
* Sets the parent of @self to @parent. The opposite function is
|
|
|
|
* clutter_actor_unparent().
|
|
|
|
*
|
2007-06-22 11:16:40 -04:00
|
|
|
* This function should not be used by applications but by custom
|
|
|
|
* 'composite' actor sub classes.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_set_parent (ClutterActor *self,
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
ClutterActor *parent)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (parent));
|
|
|
|
g_return_if_fail (self != parent);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
if (self->priv->parent_actor != NULL)
|
|
|
|
{
|
|
|
|
g_warning ("Cannot set a parent on an actor which has a parent.\n"
|
|
|
|
"You must use clutter_actor_unparent() first.\n");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)
|
|
|
|
{
|
|
|
|
g_warning ("Cannot set a parent on a toplevel actor\n");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_ref_sink (self);
|
2006-06-13 09:17:45 -04:00
|
|
|
self->priv->parent_actor = parent;
|
2006-11-20 07:02:24 -05:00
|
|
|
g_signal_emit (self, actor_signals[PARENT_SET], 0, NULL);
|
|
|
|
|
|
|
|
if (CLUTTER_ACTOR_IS_REALIZED (self->priv->parent_actor))
|
|
|
|
clutter_actor_realize (self);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
if (CLUTTER_ACTOR_IS_VISIBLE (self->priv->parent_actor) &&
|
|
|
|
CLUTTER_ACTOR_IS_VISIBLE (self))
|
2006-11-20 07:02:24 -05:00
|
|
|
{
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_get_parent:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2006-06-21 19:02:20 -04:00
|
|
|
* Retrieves the parent of @self.
|
|
|
|
*
|
2006-06-13 09:17:45 -04:00
|
|
|
* Return Value: The #ClutterActor parent or NULL
|
|
|
|
*/
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
ClutterActor *
|
2006-06-13 09:17:45 -04:00
|
|
|
clutter_actor_get_parent (ClutterActor *self)
|
|
|
|
{
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
return self->priv->parent_actor;
|
|
|
|
}
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_unparent:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
*
|
|
|
|
* This function should not be used in applications. It should be called by
|
2007-08-13 13:01:07 -04:00
|
|
|
* implementations of container actors, to dissociate a child from the
|
|
|
|
* container.
|
2006-07-06 14:55:46 -04:00
|
|
|
*
|
|
|
|
* Since: 0.1.1
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_unparent (ClutterActor *self)
|
|
|
|
{
|
2006-11-20 07:02:24 -05:00
|
|
|
ClutterActor *old_parent;
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
if (self->priv->parent_actor == NULL)
|
|
|
|
return;
|
|
|
|
|
2006-11-15 19:24:23 -05:00
|
|
|
/* just hide the actor if we are reparenting it */
|
|
|
|
if (CLUTTER_ACTOR_IS_REALIZED (self))
|
|
|
|
{
|
|
|
|
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)
|
|
|
|
clutter_actor_hide (self);
|
|
|
|
else
|
|
|
|
clutter_actor_unrealize (self);
|
|
|
|
}
|
|
|
|
|
2006-11-20 07:02:24 -05:00
|
|
|
old_parent = self->priv->parent_actor;
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
self->priv->parent_actor = NULL;
|
2006-11-20 07:02:24 -05:00
|
|
|
g_signal_emit (self, actor_signals[PARENT_SET], 0, old_parent);
|
|
|
|
|
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor
objects behave like GtkObjects - that is they have an initial
"floating" reference that gets "sunk" when they are added to
a ClutterGroup. This makes a group responsible of de-allocating
each actor inside it, so you just have to destroy the group to
get every child actor destroyed. Also, now you can do:
clutter_group_add (group, clutter_video_texture_new ());
without having to care about reference counting and explicit
unreffing.
* clutter/clutter-private.h: Add private flags setter and
getter macros.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c: Clean up; inherit from GInitiallyUnowned;
add a "visible" property; add the "destroy", "show" and "hide"
signals to ClutterActorClass.
(clutter_actor_show), (clutter_actor_hide): Refactor a bit; emit
the "show" and "hide" signals.
(clutter_actor_set_property), (clutter_actor_get_property),
(clutter_actor_class_init): Implement the "visible" property; add
signals.
(clutter_actor_finalize): Do not leak the actor's name, if it is
set.
(clutter_actor_dispose): Emit the "destroy" signal here.
(clutter_actor_init): Sink the initial floating flag if needed.
(clutter_actor_destroy): Add a function to explicitely destroy
a ClutterActor.
(clutter_actor_set_parent), (clutter_actor_get_parent),
(clutter_actor_unparent): Make set_parent require a valid parent;
add unparent; check on get_parent; ref_sink the actor when
setting its parent and unref it when unsetting it. Probably we'll
need a function that does reparenting as unparent+set_parent in
a single shot.
* clutter/clutter-group.h:
* clutter/clutter-group.c (clutter_group_dispose),
(clutter_group_finalize), (clutter_group_add),
(clutter_group_remove): Make the group destroy its children when
disposing it; clean up, and use the newly-available
clutter_actor_unparent().
* clutter/clutter-stage.h:
* clutter/clutter-stage.c (clutter_stage_init): ClutterStage is
a top-level actor; clean up.
* clutter/clutter-video-texture.h:
* clutter/clutter-video-texture.c: Clean up.
* examples/super-oh.c:
* examples/test.c:
* examples/video-player.c:
* examples/test-text.c:
* examples/video-cube.c: Remove the g_object_unref() call, as the
ClutterStage object is destroyed on clutter_main_quit().
2006-07-06 13:52:57 -04:00
|
|
|
g_object_unref (self);
|
|
|
|
}
|
|
|
|
|
2006-11-15 19:24:23 -05:00
|
|
|
/**
|
|
|
|
* clutter_actor_reparent:
|
|
|
|
* @self: a #ClutterActor
|
|
|
|
* @new_parent: the new #ClutterActor parent
|
|
|
|
*
|
|
|
|
* This function resets the parent actor of @self. It is
|
|
|
|
* logically equivalent to calling clutter_actory_unparent()
|
|
|
|
* and clutter_actor_set_parent().
|
|
|
|
*
|
2006-11-20 07:02:24 -05:00
|
|
|
* Since: 0.2
|
2006-11-15 19:24:23 -05:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_reparent (ClutterActor *self,
|
|
|
|
ClutterActor *new_parent)
|
|
|
|
{
|
2007-06-07 10:41:35 -04:00
|
|
|
ClutterActorPrivate *priv;
|
|
|
|
|
2006-11-15 19:24:23 -05:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (new_parent));
|
|
|
|
g_return_if_fail (self != new_parent);
|
|
|
|
|
|
|
|
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)
|
|
|
|
{
|
|
|
|
g_warning ("Cannot set a parent on a toplevel actor\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-07 10:41:35 -04:00
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->parent_actor != new_parent)
|
2006-11-15 19:24:23 -05:00
|
|
|
{
|
2006-11-20 07:02:24 -05:00
|
|
|
ClutterActor *old_parent;
|
|
|
|
|
2006-11-15 19:24:23 -05:00
|
|
|
/* if the actor and the parent have already been realized,
|
|
|
|
* mark the actor as reparenting, so that clutter_actor_unparent()
|
|
|
|
* just hides the actor instead of unrealize it.
|
|
|
|
*/
|
|
|
|
if (CLUTTER_ACTOR_IS_REALIZED (self) &&
|
|
|
|
CLUTTER_ACTOR_IS_REALIZED (new_parent))
|
|
|
|
{
|
|
|
|
CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_REPARENT);
|
|
|
|
}
|
|
|
|
|
2007-06-07 10:41:35 -04:00
|
|
|
old_parent = priv->parent_actor;
|
2006-11-20 07:02:24 -05:00
|
|
|
|
2006-11-15 19:24:23 -05:00
|
|
|
g_object_ref (self);
|
2007-06-07 10:41:35 -04:00
|
|
|
|
2007-06-22 11:16:40 -04:00
|
|
|
/* FIXME: below assumes only containers can reparent */
|
|
|
|
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->parent_actor),
|
|
|
|
self);
|
2007-06-07 10:41:35 -04:00
|
|
|
clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self);
|
|
|
|
|
2006-11-15 19:24:23 -05:00
|
|
|
g_object_unref (self);
|
|
|
|
|
|
|
|
if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_REPARENT)
|
|
|
|
{
|
|
|
|
CLUTTER_UNSET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_REPARENT);
|
|
|
|
|
|
|
|
clutter_actor_queue_redraw (self);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
/**
|
|
|
|
* clutter_actor_raise:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @below: A #ClutterActor to raise above.
|
|
|
|
*
|
2006-06-21 19:02:20 -04:00
|
|
|
* Puts @self above @below.
|
2006-06-13 09:17:45 -04:00
|
|
|
* Both actors must have the same parent.
|
|
|
|
*/
|
|
|
|
void
|
2006-11-20 07:02:24 -05:00
|
|
|
clutter_actor_raise (ClutterActor *self,
|
|
|
|
ClutterActor *below)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2006-11-20 07:02:24 -05:00
|
|
|
ClutterActor *parent;
|
2006-06-13 09:17:45 -04:00
|
|
|
|
2006-11-20 07:02:24 -05:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
|
|
|
|
|
|
|
parent = clutter_actor_get_parent (self);
|
|
|
|
if (!parent)
|
|
|
|
{
|
2007-08-13 13:01:07 -04:00
|
|
|
g_warning ("Actor of type %s is not inside a container",
|
2006-11-20 07:02:24 -05:00
|
|
|
g_type_name (G_OBJECT_TYPE (self)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (below)
|
|
|
|
{
|
|
|
|
if (parent != clutter_actor_get_parent (below))
|
|
|
|
{
|
|
|
|
g_warning ("Actor of type %s is not in the same "
|
2007-08-13 13:01:07 -04:00
|
|
|
"container of actor of type %s",
|
2006-11-20 07:02:24 -05:00
|
|
|
g_type_name (G_OBJECT_TYPE (self)),
|
|
|
|
g_type_name (G_OBJECT_TYPE (below)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-14 04:01:33 -04:00
|
|
|
clutter_container_raise_child (CLUTTER_CONTAINER (parent), self, below);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_lower:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
* @above: A #ClutterActor to lower below
|
|
|
|
*
|
2006-06-21 19:02:20 -04:00
|
|
|
* Puts @self below @above.
|
2006-06-13 09:17:45 -04:00
|
|
|
* Both actors must have the same parent.
|
|
|
|
*/
|
|
|
|
void
|
2006-11-20 07:02:24 -05:00
|
|
|
clutter_actor_lower (ClutterActor *self,
|
|
|
|
ClutterActor *above)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2006-11-20 07:02:24 -05:00
|
|
|
ClutterActor *parent;
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR(self));
|
|
|
|
|
2006-11-20 07:02:24 -05:00
|
|
|
parent = clutter_actor_get_parent (self);
|
|
|
|
if (!parent)
|
2006-06-13 09:17:45 -04:00
|
|
|
{
|
2007-08-13 13:01:07 -04:00
|
|
|
g_warning ("Actor of type %s is not inside a container",
|
2006-11-20 07:02:24 -05:00
|
|
|
g_type_name (G_OBJECT_TYPE (self)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (above)
|
|
|
|
{
|
|
|
|
if (parent != clutter_actor_get_parent (above))
|
|
|
|
{
|
|
|
|
g_warning ("Actor of type %s is not in the same "
|
2007-08-13 13:01:07 -04:00
|
|
|
"container of actor of type %s",
|
2006-11-20 07:02:24 -05:00
|
|
|
g_type_name (G_OBJECT_TYPE (self)),
|
|
|
|
g_type_name (G_OBJECT_TYPE (above)));
|
|
|
|
return;
|
|
|
|
}
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
2007-08-14 04:01:33 -04:00
|
|
|
clutter_container_lower_child (CLUTTER_CONTAINER (parent), self, above);
|
2006-06-13 09:17:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-06-22 09:05:45 -04:00
|
|
|
* clutter_actor_raise_top:
|
2006-06-13 09:17:45 -04:00
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
2006-06-21 19:02:20 -04:00
|
|
|
* Raises @self to the top.
|
2006-06-13 09:17:45 -04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_raise_top (ClutterActor *self)
|
|
|
|
{
|
|
|
|
clutter_actor_raise (self, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_lower_bottom:
|
|
|
|
* @self: A #ClutterActor
|
|
|
|
*
|
|
|
|
* Lowers @self to the bottom.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_actor_lower_bottom (ClutterActor *self)
|
|
|
|
{
|
|
|
|
clutter_actor_lower (self, NULL);
|
|
|
|
}
|
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
/*
|
|
|
|
* Event handling
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_actor_event:
|
|
|
|
* @actor: a #ClutterActor
|
|
|
|
* @event: a #ClutterEvent
|
|
|
|
*
|
|
|
|
* This function is used to emit an event on the main stage.
|
|
|
|
* You should rarely need to use this function, except for
|
|
|
|
* synthetising events.
|
|
|
|
*
|
|
|
|
* Return value: the return value from the signal emission
|
|
|
|
*
|
2007-08-15 15:50:31 -04:00
|
|
|
* Since: 0.6
|
2007-08-13 16:48:01 -04:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_actor_event (ClutterActor *actor,
|
|
|
|
ClutterEvent *event)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
gint signal_num = -1;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
g_object_ref (actor);
|
2007-08-21 11:48:51 -04:00
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
g_signal_emit (actor, actor_signals[EVENT], 0, event);
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case CLUTTER_NOTHING:
|
|
|
|
break;
|
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
case CLUTTER_2BUTTON_PRESS:
|
|
|
|
case CLUTTER_3BUTTON_PRESS:
|
|
|
|
signal_num = BUTTON_PRESS_EVENT;
|
|
|
|
break;
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
signal_num = BUTTON_RELEASE_EVENT;
|
|
|
|
break;
|
|
|
|
case CLUTTER_SCROLL:
|
|
|
|
signal_num = SCROLL_EVENT;
|
|
|
|
break;
|
|
|
|
case CLUTTER_KEY_PRESS:
|
|
|
|
signal_num = KEY_PRESS_EVENT;
|
|
|
|
break;
|
|
|
|
case CLUTTER_KEY_RELEASE:
|
|
|
|
signal_num = KEY_RELEASE_EVENT;
|
|
|
|
break;
|
|
|
|
case CLUTTER_MOTION:
|
|
|
|
signal_num = MOTION_EVENT;
|
|
|
|
break;
|
|
|
|
case CLUTTER_DELETE:
|
|
|
|
signal_num = -1;
|
|
|
|
break;
|
|
|
|
case CLUTTER_DESTROY_NOTIFY:
|
|
|
|
signal_num = -1;
|
|
|
|
break;
|
|
|
|
case CLUTTER_CLIENT_MESSAGE:
|
|
|
|
signal_num = -1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (signal_num != -1)
|
|
|
|
{
|
|
|
|
g_signal_emit (actor, actor_signals[signal_num], 0, event);
|
|
|
|
g_signal_emit (actor, actor_signals[EVENT_AFTER], 0, event);
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref (actor);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clutter_actor_set_reactive (ClutterActor *actor)
|
|
|
|
{
|
2007-08-15 15:50:31 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
CLUTTER_ACTOR_SET_FLAGS (actor, CLUTTER_ACTOR_REACTIVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clutter_actor_unset_reactive (ClutterActor *actor)
|
|
|
|
{
|
2007-08-15 15:50:31 -04:00
|
|
|
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
|
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REACTIVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
clutter_actor_is_reactive (ClutterActor *actor)
|
|
|
|
{
|
2007-08-15 15:50:31 -04:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
|
|
|
|
|
2007-08-13 16:48:01 -04:00
|
|
|
return CLUTTER_ACTOR_IS_REACTIVE(actor);
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/*
|
|
|
|
* ClutterGemoetry
|
|
|
|
*/
|
|
|
|
|
|
|
|
static ClutterGeometry*
|
|
|
|
clutter_geometry_copy (const ClutterGeometry *geometry)
|
|
|
|
{
|
|
|
|
ClutterGeometry *result = g_new (ClutterGeometry, 1);
|
|
|
|
|
|
|
|
*result = *geometry;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
clutter_geometry_get_type (void)
|
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
|
|
|
|
|
|
|
if (our_type == 0)
|
2007-08-13 16:48:01 -04:00
|
|
|
our_type = g_boxed_type_register_static
|
|
|
|
(g_intern_static_string ("ClutterGeometry"),
|
|
|
|
(GBoxedCopyFunc) clutter_geometry_copy,
|
|
|
|
(GBoxedFreeFunc) g_free);
|
2006-06-13 09:17:45 -04:00
|
|
|
|
|
|
|
return our_type;
|
|
|
|
}
|
|
|
|
|
2007-05-31 05:29:12 -04:00
|
|
|
/*
|
|
|
|
* ClutterVertices
|
|
|
|
*/
|
|
|
|
|
2007-07-04 05:17:10 -04:00
|
|
|
static ClutterVertex *
|
2007-06-12 07:42:29 -04:00
|
|
|
clutter_vertex_copy (const ClutterVertex *vertex)
|
2007-05-31 05:29:12 -04:00
|
|
|
{
|
2007-06-12 07:42:29 -04:00
|
|
|
ClutterVertex *result = g_new (ClutterVertex, 1);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
2007-06-12 07:42:29 -04:00
|
|
|
*result = *vertex;
|
2007-05-31 05:29:12 -04:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
2007-06-12 07:42:29 -04:00
|
|
|
clutter_vertex_get_type (void)
|
2007-05-31 05:29:12 -04:00
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
|
|
|
|
|
|
|
if (our_type == 0)
|
2007-08-13 16:48:01 -04:00
|
|
|
our_type = g_boxed_type_register_static
|
|
|
|
(g_intern_static_string ("ClutterVertex"),
|
|
|
|
(GBoxedCopyFunc) clutter_vertex_copy,
|
|
|
|
(GBoxedFreeFunc) g_free);
|
2007-05-31 05:29:12 -04:00
|
|
|
|
|
|
|
return our_type;
|
|
|
|
}
|
|
|
|
|
2006-06-13 09:17:45 -04:00
|
|
|
/*
|
|
|
|
* ClutterActorBox
|
|
|
|
*/
|
|
|
|
static ClutterActorBox *
|
|
|
|
clutter_actor_box_copy (const ClutterActorBox *box)
|
|
|
|
{
|
|
|
|
ClutterActorBox *result = g_new (ClutterActorBox, 1);
|
|
|
|
|
|
|
|
*result = *box;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
clutter_actor_box_get_type (void)
|
|
|
|
{
|
|
|
|
static GType our_type = 0;
|
|
|
|
|
|
|
|
if (our_type == 0)
|
2007-08-13 16:48:01 -04:00
|
|
|
our_type = g_boxed_type_register_static
|
|
|
|
(g_intern_static_string ("ClutterActorBox"),
|
|
|
|
(GBoxedCopyFunc) clutter_actor_box_copy,
|
|
|
|
(GBoxedFreeFunc) g_free);
|
2006-06-13 09:17:45 -04:00
|
|
|
return our_type;
|
|
|
|
}
|
2007-05-18 03:30:06 -04:00
|
|
|
|