Commit bed2d9e7 authored by Adel Gadllah's avatar Adel Gadllah

ClutterActor: Add clutter_actor_has_effects

Adds an efficent way to query whether an actor has any
applied effects.

https://bugzilla.gnome.org/show_bug.cgi?id=660471
parent e058cd4c
......@@ -75,6 +75,8 @@ void _clutter_meta_group_clear_metas (ClutterMetaGroup *group
ClutterActorMeta * _clutter_meta_group_get_meta (ClutterMetaGroup *group,
const gchar *name);
gboolean _clutter_meta_group_has_metas_no_internal (ClutterMetaGroup *group);
GList * _clutter_meta_group_get_metas_no_internal (ClutterMetaGroup *group);
void _clutter_meta_group_clear_metas_no_internal (ClutterMetaGroup *group);
......
......@@ -552,6 +552,27 @@ _clutter_meta_group_get_metas_no_internal (ClutterMetaGroup *group)
return g_list_reverse (ret);
}
/*
* _clutter_meta_group_has_metas_no_internal:
* @group: a #ClutterMetaGroup
*
* Returns whether the group has any metas that have an internal priority.
*
* Return value: %TRUE if metas with internal priority exist
* %FALSE otherwise
*/
gboolean
_clutter_meta_group_has_metas_no_internal (ClutterMetaGroup *group)
{
GList *l;
for (l = group->meta; l; l = l->next)
if (_clutter_actor_meta_is_internal (l->data))
return TRUE;
return FALSE;
}
/*
* _clutter_meta_group_clear_metas:
* @group: a #ClutterMetaGroup
......
......@@ -12452,6 +12452,28 @@ clutter_actor_has_overlaps (ClutterActor *self)
return CLUTTER_ACTOR_GET_CLASS (self)->has_overlaps (self);
}
/**
* clutter_actor_has_effects:
* @self: A #ClutterActor
*
* Returns whether the actor has any effects applied.
*
* Return value: %TRUE if the actor has any effects,
* %FALSE otherwise
*
* Since: 1.10
*/
gboolean
clutter_actor_has_effects (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), TRUE);
if (self->priv->effects == NULL)
return FALSE;
return _clutter_meta_group_has_metas_no_internal (self->priv->effects);
}
gint
_clutter_actor_get_n_children (ClutterActor *self)
{
......
......@@ -126,6 +126,8 @@ ClutterEffect *clutter_actor_get_effect (ClutterActor *self,
const gchar *name);
void clutter_actor_clear_effects (ClutterActor *self);
gboolean clutter_actor_has_effects (ClutterActor *self);
G_END_DECLS
#endif /* __CLUTTER_EFFECT_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment