[mutter] clutter/actor: Add API to check whether actor or clone is on view
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/actor: Add API to check whether actor or clone is on view
- Date: Thu, 2 Jul 2020 20:55:48 +0000 (UTC)
commit 2f4d50c723c3794b701dbbb45e45d7ad6680a6f2
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Jun 25 16:00:15 2020 +0200
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
clutter/clutter/clutter-actor.c | 34 ++++++++++++++++++++++++++++++++++
clutter/clutter/clutter-mutter.h | 4 ++++
2 files changed, 38 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 3662689ff8..1bd88bcd35 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -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
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
index 5aa9a7e145..6ca7904b24 100644
--- a/clutter/clutter/clutter-mutter.h
+++ b/clutter/clutter/clutter-mutter.h
@@ -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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]