mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 11:02:05 +00:00
clutter/actor: Add API to check whether actor or clone is on view
The new function returns TRUE if an actor is effectively on the passed view, where effectively refers to itself or a clone containing itself. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
parent
4b8bb4608c
commit
2f4d50c723
@ -16258,6 +16258,40 @@ clutter_actor_peek_stage_views (ClutterActor *self)
|
||||
return self->priv->stage_views;
|
||||
}
|
||||
|
||||
gboolean
|
||||
clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
|
||||
ClutterStageView *view)
|
||||
{
|
||||
ClutterActor *actor;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
if (g_list_find (self->priv->stage_views, view))
|
||||
return TRUE;
|
||||
|
||||
for (actor = self; actor; actor = actor->priv->parent)
|
||||
{
|
||||
if (actor->priv->clones)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
|
||||
g_hash_table_iter_init (&iter, actor->priv->clones);
|
||||
while (g_hash_table_iter_next (&iter, &key, NULL))
|
||||
{
|
||||
ClutterActor *clone = key;
|
||||
GList *clone_views;
|
||||
|
||||
clone_views = clutter_actor_peek_stage_views (clone);
|
||||
if (g_list_find (clone_views, view))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_pick_frame_clock:
|
||||
* @self: a #ClutterActor
|
||||
|
@ -39,6 +39,10 @@
|
||||
CLUTTER_EXPORT
|
||||
GList * clutter_stage_peek_stage_views (ClutterStage *stage);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
gboolean clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
|
||||
ClutterStageView *view);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user