mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 11:02:05 +00:00
2006-11-16 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-private.h: * clutter/clutter-actor.c: Implement the defined clutter_actor_reparent() method; call unrealize when unparenting an actor.
This commit is contained in:
parent
734f808fbc
commit
252368901f
@ -1,3 +1,10 @@
|
||||
2006-11-16 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-private.h:
|
||||
* clutter/clutter-actor.c: Implement the defined
|
||||
clutter_actor_reparent() method; call unrealize
|
||||
when unparenting an actor.
|
||||
|
||||
2006-11-15 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* clutter/clutter-alpha.h:
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "clutter-actor.h"
|
||||
#include "clutter-group.h"
|
||||
#include "clutter-main.h"
|
||||
#include "clutter-enum-types.h"
|
||||
#include "clutter-marshal.h"
|
||||
@ -1575,10 +1576,69 @@ clutter_actor_unparent (ClutterActor *self)
|
||||
if (self->priv->parent_actor == NULL)
|
||||
return;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
self->priv->parent_actor = NULL;
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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().
|
||||
*
|
||||
* Since: 0.1.1
|
||||
*/
|
||||
void
|
||||
clutter_actor_reparent (ClutterActor *self,
|
||||
ClutterActor *new_parent)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (self->priv->parent_actor != new_parent)
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
|
||||
g_object_ref (self);
|
||||
clutter_group_remove (CLUTTER_GROUP (self->priv->parent_actor), self);
|
||||
clutter_group_add (CLUTTER_GROUP (new_parent), self);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* clutter_actor_raise:
|
||||
* @self: A #ClutterActor
|
||||
|
@ -76,7 +76,8 @@ typedef enum {
|
||||
CLUTTER_ACTOR_UNUSED_FLAG = 0,
|
||||
|
||||
CLUTTER_ACTOR_IN_DESTRUCTION = 1 << 0,
|
||||
CLUTTER_ACTOR_IS_TOPLEVEL = 1 << 1
|
||||
CLUTTER_ACTOR_IS_TOPLEVEL = 1 << 1,
|
||||
CLUTTER_ACTOR_IN_REPARENT = 1 << 2
|
||||
} ClutterPrivateFlags;
|
||||
|
||||
#define CLUTTER_PRIVATE_FLAGS(a) (CLUTTER_ACTOR ((a))->private_flags)
|
||||
|
@ -37,6 +37,7 @@ clutter-main
|
||||
@a...:
|
||||
@a...:
|
||||
@a...:
|
||||
@a...:
|
||||
@a...:
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user