diff --git a/src/core/boxes-private.h b/src/core/boxes-private.h index d39816495..09cbd6e09 100644 --- a/src/core/boxes-private.h +++ b/src/core/boxes-private.h @@ -158,6 +158,10 @@ gboolean meta_rectangle_overlaps_with_region ( const GList *spanning_rects, const MetaRectangle *rect); +gboolean meta_rectangle_is_adjacent_to_any_in_region ( + const GList *spanning_rects, + MetaRectangle *rect); + /* Make the rectangle small enough to fit into one of the spanning_rects, * but make it no smaller than min_size. */ diff --git a/src/core/boxes.c b/src/core/boxes.c index 9a9633e05..a94d0d77f 100644 --- a/src/core/boxes.c +++ b/src/core/boxes.c @@ -899,6 +899,25 @@ meta_rectangle_overlaps_with_region (const GList *spanning_rects, return overlaps; } +gboolean +meta_rectangle_is_adjacent_to_any_in_region (const GList *spanning_rects, + MetaRectangle *rect) +{ + const GList *l; + + for (l = spanning_rects; l; l = l->next) + { + MetaRectangle *other = (MetaRectangle *) l->data; + + if (rect == other || meta_rectangle_equal (rect, other)) + continue; + + if (meta_rectangle_is_adjacent_to (rect, other)) + return TRUE; + } + + return FALSE; +} void meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects,