mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
bind: Check that the source is not contained inside the actor
Like commit d0439cfb586ca14282c89035119a4acbc0295df7 for AlignConstraint, let's check that the BindConstraint source is not a child or a grandchild of the actor attached to the Constraint.
This commit is contained in:
parent
e6dbdb444d
commit
66607dec4d
@ -88,6 +88,8 @@
|
||||
|
||||
#include "clutter-bind-constraint.h"
|
||||
|
||||
#include "clutter-actor-meta-private.h"
|
||||
#include "clutter-actor-private.h"
|
||||
#include "clutter-constraint.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
@ -208,6 +210,19 @@ clutter_bind_constraint_set_actor (ClutterActorMeta *meta,
|
||||
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (meta);
|
||||
ClutterActorMetaClass *parent;
|
||||
|
||||
if (new_actor != NULL &&
|
||||
bind->source != NULL &&
|
||||
clutter_actor_contains (new_actor, bind->source))
|
||||
{
|
||||
g_warning (G_STRLOC ": The source actor '%s' is contained "
|
||||
"by the actor '%s' associated to the constraint "
|
||||
"'%s'",
|
||||
_clutter_actor_get_debug_name (bind->source),
|
||||
_clutter_actor_get_debug_name (new_actor),
|
||||
_clutter_actor_meta_get_debug_name (meta));
|
||||
return;
|
||||
}
|
||||
|
||||
/* store the pointer to the actor, for later use */
|
||||
bind->actor = new_actor;
|
||||
|
||||
@ -307,7 +322,10 @@ clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
|
||||
/**
|
||||
* ClutterBindConstraint:source:
|
||||
*
|
||||
* The #ClutterActor used as the source for the binding
|
||||
* The #ClutterActor used as the source for the binding.
|
||||
*
|
||||
* The #ClutterActor must not be contained inside the actor associated
|
||||
* to the constraint.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
@ -403,7 +421,8 @@ void
|
||||
clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
|
||||
ClutterActor *source)
|
||||
{
|
||||
ClutterActor *old_source;
|
||||
ClutterActor *old_source, *actor;
|
||||
ClutterActorMeta *meta;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BIND_CONSTRAINT (constraint));
|
||||
g_return_if_fail (source == NULL || CLUTTER_IS_ACTOR (source));
|
||||
@ -411,6 +430,22 @@ clutter_bind_constraint_set_source (ClutterBindConstraint *constraint,
|
||||
if (constraint->source == source)
|
||||
return;
|
||||
|
||||
meta = CLUTTER_ACTOR_META (constraint);
|
||||
actor = clutter_actor_meta_get_actor (meta);
|
||||
if (source != NULL && actor != NULL)
|
||||
{
|
||||
if (clutter_actor_contains (actor, source))
|
||||
{
|
||||
g_warning (G_STRLOC ": The source actor '%s' is contained "
|
||||
"by the actor '%s' associated to the constraint "
|
||||
"'%s'",
|
||||
_clutter_actor_get_debug_name (source),
|
||||
_clutter_actor_get_debug_name (actor),
|
||||
_clutter_actor_meta_get_debug_name (meta));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
old_source = constraint->source;
|
||||
if (old_source != NULL)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user