From 4e5ac0186c6ea96c46d6167651111bac24ccfcd5 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Tue, 14 Jun 2022 01:04:03 +0300 Subject: [PATCH] surface-actor: Allow checking if a surface actor covers a rect Part-of: --- src/compositor/meta-surface-actor.c | 16 ++++++++++++++++ src/compositor/meta-surface-actor.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index ced80648a..e9bfa8126 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -537,6 +537,22 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self, stage_view); } +gboolean +meta_surface_actor_contains_rect (MetaSurfaceActor *surface_actor, + MtkRectangle *rect) +{ + ClutterActor *actor = CLUTTER_ACTOR (surface_actor); + graphene_rect_t bounding_rect; + graphene_rect_t bound_rect; + + clutter_actor_get_transformed_extents (actor, &bounding_rect); + + bound_rect = mtk_rectangle_to_graphene_rect (rect); + + return graphene_rect_contains_rect (&bounding_rect, + &bound_rect); +} + void meta_surface_actor_set_input_region (MetaSurfaceActor *self, MtkRegion *region) diff --git a/src/compositor/meta-surface-actor.h b/src/compositor/meta-surface-actor.h index 722e7d140..2823076b3 100644 --- a/src/compositor/meta-surface-actor.h +++ b/src/compositor/meta-surface-actor.h @@ -40,6 +40,9 @@ gboolean meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self, ClutterStageView *stage_view, float *unobscurred_fraction); +gboolean meta_surface_actor_contains_rect (MetaSurfaceActor *surface_actor, + MtkRectangle *rect); + void meta_surface_actor_set_input_region (MetaSurfaceActor *self, MtkRegion *region); void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,