diff --git a/clutter/clutter/clutter-stage-private.h b/clutter/clutter/clutter-stage-private.h index 9f018ab84..ba4a77b73 100644 --- a/clutter/clutter/clutter-stage-private.h +++ b/clutter/clutter/clutter-stage-private.h @@ -136,6 +136,9 @@ void _clutter_stage_presented (ClutterStage *stag void clutter_stage_queue_actor_relayout (ClutterStage *stage, ClutterActor *actor); +GList * clutter_stage_get_views_for_rect (ClutterStage *stage, + const graphene_rect_t *rect); + G_END_DECLS #endif /* __CLUTTER_STAGE_PRIVATE_H__ */ diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 61737abd4..fed84e9b0 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -4404,3 +4404,27 @@ _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage, *view_scale = scale; return TRUE; } + +GList * +clutter_stage_get_views_for_rect (ClutterStage *stage, + const graphene_rect_t *rect) +{ + ClutterStagePrivate *priv = stage->priv; + GList *views_for_rect = NULL; + GList *l; + + for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next) + { + ClutterStageView *view = l->data; + cairo_rectangle_int_t view_layout; + graphene_rect_t view_rect; + + clutter_stage_view_get_layout (view, &view_layout); + _clutter_util_rect_from_rectangle (&view_layout, &view_rect); + + if (graphene_rect_intersection (&view_rect, rect, NULL)) + views_for_rect = g_list_prepend (views_for_rect, view); + } + + return views_for_rect; +}