mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 07:30:42 -05:00
boxes: Add function to check if rectangle is adjacent to region
We may need to check if rectangles region has adjacent neighbors and so if there are no gaps in between monitors. This can be done by checking if each monitor is adjacent to any other in the same region. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
This commit is contained in:
parent
d3602e9fef
commit
58c2f423f7
@ -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.
|
||||
*/
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user