mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
mtk: Move Rectangle.overlap_* from Meta
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
This commit is contained in:
parent
db77759938
commit
eafe07de31
@ -186,3 +186,60 @@ mtk_rectangle_intersect (const MtkRectangle *src1,
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* mtk_rectangle_overlap:
|
||||
* @rect1: The first rectangle
|
||||
* @rect2: The second rectangle
|
||||
*
|
||||
* Similar to [method@Rectangle.intersect] but doesn't provide
|
||||
* the location of the intersection.
|
||||
*
|
||||
* Returns: Whether the two rectangles overlap
|
||||
*/
|
||||
gboolean
|
||||
mtk_rectangle_overlap (const MtkRectangle *rect1,
|
||||
const MtkRectangle *rect2)
|
||||
{
|
||||
g_return_val_if_fail (rect1 != NULL, FALSE);
|
||||
g_return_val_if_fail (rect2 != NULL, FALSE);
|
||||
|
||||
return !((rect1->x + rect1->width <= rect2->x) ||
|
||||
(rect2->x + rect2->width <= rect1->x) ||
|
||||
(rect1->y + rect1->height <= rect2->y) ||
|
||||
(rect2->y + rect2->height <= rect1->y));
|
||||
}
|
||||
|
||||
/**
|
||||
* mtk_rectangle_vert_overlap:
|
||||
* @rect1: The first rectangle
|
||||
* @rect2: The second rectangle
|
||||
*
|
||||
* Similar to [method@Rectangle.overlap] but ignores the horizontal location.
|
||||
*
|
||||
* Returns: Whether the two rectangles overlap vertically
|
||||
*/
|
||||
gboolean
|
||||
mtk_rectangle_vert_overlap (const MtkRectangle *rect1,
|
||||
const MtkRectangle *rect2)
|
||||
{
|
||||
return (rect1->y < rect2->y + rect2->height &&
|
||||
rect2->y < rect1->y + rect1->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* mtk_rectangle_horiz_overlap:
|
||||
* @rect1: The first rectangle
|
||||
* @rect2: The second rectangle
|
||||
*
|
||||
* Similar to [method@Rectangle.overlap] but ignores the vertical location.
|
||||
*
|
||||
* Returns: Whether the two rectangles overlap horizontally
|
||||
*/
|
||||
gboolean
|
||||
mtk_rectangle_horiz_overlap (const MtkRectangle *rect1,
|
||||
const MtkRectangle *rect2)
|
||||
{
|
||||
return (rect1->x < rect2->x + rect2->width &&
|
||||
rect2->x < rect1->x + rect1->width);
|
||||
}
|
||||
|
@ -98,3 +98,15 @@ gboolean mtk_rectangle_intersect (const MtkRectangle *src1,
|
||||
const MtkRectangle *src2,
|
||||
MtkRectangle *dest);
|
||||
|
||||
MTK_EXPORT
|
||||
gboolean mtk_rectangle_overlap (const MtkRectangle *rect1,
|
||||
const MtkRectangle *rect2);
|
||||
|
||||
MTK_EXPORT
|
||||
gboolean mtk_rectangle_vert_overlap (const MtkRectangle *rect1,
|
||||
const MtkRectangle *rect2);
|
||||
|
||||
MTK_EXPORT
|
||||
gboolean mtk_rectangle_horiz_overlap (const MtkRectangle *rect1,
|
||||
const MtkRectangle *rect2);
|
||||
|
||||
|
@ -310,29 +310,29 @@ meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor,
|
||||
case META_DISPLAY_RIGHT:
|
||||
if (neighbor->rect.x == (logical_monitor->rect.x +
|
||||
logical_monitor->rect.width) &&
|
||||
meta_rectangle_vert_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
mtk_rectangle_vert_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
return TRUE;
|
||||
break;
|
||||
case META_DISPLAY_LEFT:
|
||||
if (logical_monitor->rect.x == (neighbor->rect.x +
|
||||
neighbor->rect.width) &&
|
||||
meta_rectangle_vert_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
mtk_rectangle_vert_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
return TRUE;
|
||||
break;
|
||||
case META_DISPLAY_UP:
|
||||
if (logical_monitor->rect.y == (neighbor->rect.y +
|
||||
neighbor->rect.height) &&
|
||||
meta_rectangle_horiz_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
mtk_rectangle_horiz_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
return TRUE;
|
||||
break;
|
||||
case META_DISPLAY_DOWN:
|
||||
if (neighbor->rect.y == (logical_monitor->rect.y +
|
||||
logical_monitor->rect.height) &&
|
||||
meta_rectangle_horiz_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
mtk_rectangle_horiz_overlap (&neighbor->rect,
|
||||
&logical_monitor->rect))
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ add_view_painted_watches (MetaScreenCastAreaStreamSrc *area_src)
|
||||
MetaRectangle view_layout;
|
||||
|
||||
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view), &view_layout);
|
||||
if (meta_rectangle_overlap (area, &view_layout))
|
||||
if (mtk_rectangle_overlap (area, &view_layout))
|
||||
{
|
||||
MetaStageWatch *watch;
|
||||
|
||||
|
@ -68,7 +68,7 @@ calculate_scale (ClutterStage *stage,
|
||||
MetaRectangle view_layout;
|
||||
|
||||
clutter_stage_view_get_layout (stage_view, &view_layout);
|
||||
if (meta_rectangle_overlap (area, &view_layout))
|
||||
if (mtk_rectangle_overlap (area, &view_layout))
|
||||
scale = MAX (clutter_stage_view_get_scale (stage_view), scale);
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ add_view_watches (MetaScreenCastMonitorStreamSrc *monitor_src,
|
||||
MetaRectangle view_layout;
|
||||
|
||||
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view), &view_layout);
|
||||
if (meta_rectangle_overlap (&logical_monitor_layout, &view_layout))
|
||||
if (mtk_rectangle_overlap (&logical_monitor_layout, &view_layout))
|
||||
{
|
||||
MetaStageWatch *watch;
|
||||
|
||||
@ -652,7 +652,7 @@ meta_screen_cast_monitor_stream_record_follow_up (MetaScreenCastStreamSrc *src)
|
||||
|
||||
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view), &view_layout);
|
||||
|
||||
if (!meta_rectangle_overlap (&logical_monitor_layout, &view_layout))
|
||||
if (!mtk_rectangle_overlap (&logical_monitor_layout, &view_layout))
|
||||
continue;
|
||||
|
||||
damage = (MtkRectangle) {
|
||||
|
@ -136,22 +136,22 @@ view_has_neighbor (MtkRectangle *view,
|
||||
{
|
||||
case META_DISPLAY_RIGHT:
|
||||
if (neighbor->x == (view->x + view->width) &&
|
||||
meta_rectangle_vert_overlap (neighbor, view))
|
||||
mtk_rectangle_vert_overlap (neighbor, view))
|
||||
return TRUE;
|
||||
break;
|
||||
case META_DISPLAY_LEFT:
|
||||
if (view->x == (neighbor->x + neighbor->width) &&
|
||||
meta_rectangle_vert_overlap (neighbor, view))
|
||||
mtk_rectangle_vert_overlap (neighbor, view))
|
||||
return TRUE;
|
||||
break;
|
||||
case META_DISPLAY_UP:
|
||||
if (view->y == (neighbor->y + neighbor->height) &&
|
||||
meta_rectangle_horiz_overlap (neighbor, view))
|
||||
mtk_rectangle_horiz_overlap (neighbor, view))
|
||||
return TRUE;
|
||||
break;
|
||||
case META_DISPLAY_DOWN:
|
||||
if (neighbor->y == (view->y + view->height) &&
|
||||
meta_rectangle_horiz_overlap (neighbor, view))
|
||||
mtk_rectangle_horiz_overlap (neighbor, view))
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ update_top_window_actor (MetaCompositor *compositor)
|
||||
meta_display_get_size (priv->display,
|
||||
&display_rect.width, &display_rect.height);
|
||||
|
||||
if (meta_rectangle_overlap (&display_rect, &buffer_rect))
|
||||
if (mtk_rectangle_overlap (&display_rect, &buffer_rect))
|
||||
{
|
||||
top_window_actor = window_actor;
|
||||
break;
|
||||
|
@ -237,8 +237,8 @@ find_nearest_position (const GArray *edges,
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
edges_align = horizontal ?
|
||||
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
mtk_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
mtk_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
|
||||
if (edges_align &&
|
||||
(!only_forward ||
|
||||
@ -261,8 +261,8 @@ find_nearest_position (const GArray *edges,
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
edges_align = horizontal ?
|
||||
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
mtk_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
mtk_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
|
||||
if (edges_align &&
|
||||
(!only_forward ||
|
||||
|
@ -80,7 +80,7 @@ find_top_window_actor_on_view (ClutterStageView *stage_view,
|
||||
clutter_stage_view_get_layout (stage_view,
|
||||
&view_layout);
|
||||
|
||||
if (meta_rectangle_overlap (&view_layout, &buffer_rect))
|
||||
if (mtk_rectangle_overlap (&view_layout, &buffer_rect))
|
||||
return window_actor;
|
||||
}
|
||||
|
||||
|
106
src/core/boxes.c
106
src/core/boxes.c
@ -131,35 +131,7 @@ meta_rectangle_edge_list_to_string (GList *edge_list,
|
||||
cur = g_stpcpy (cur, separator_string);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
gboolean
|
||||
meta_rectangle_overlap (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2)
|
||||
{
|
||||
g_return_val_if_fail (rect1 != NULL, FALSE);
|
||||
g_return_val_if_fail (rect2 != NULL, FALSE);
|
||||
|
||||
return !((rect1->x + rect1->width <= rect2->x) ||
|
||||
(rect2->x + rect2->width <= rect1->x) ||
|
||||
(rect1->y + rect1->height <= rect2->y) ||
|
||||
(rect2->y + rect2->height <= rect1->y));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_rectangle_vert_overlap (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2)
|
||||
{
|
||||
return (rect1->y < rect2->y + rect2->height &&
|
||||
rect2->y < rect1->y + rect1->height);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_rectangle_horiz_overlap (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2)
|
||||
{
|
||||
return (rect1->x < rect2->x + rect2->width &&
|
||||
rect2->x < rect1->x + rect1->width);
|
||||
return output;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -324,7 +296,7 @@ merge_spanning_rects_in_region (GList *region)
|
||||
else if (a->y == b->y && a->height == b->height)
|
||||
{
|
||||
/* If a and b overlap */
|
||||
if (meta_rectangle_overlap (a, b))
|
||||
if (mtk_rectangle_overlap (a, b))
|
||||
{
|
||||
int new_x = MIN (a->x, b->x);
|
||||
a->width = MAX (a->x + a->width, b->x + b->width) - new_x;
|
||||
@ -344,7 +316,7 @@ merge_spanning_rects_in_region (GList *region)
|
||||
else if (a->x == b->x && a->width == b->width)
|
||||
{
|
||||
/* If a and b overlap */
|
||||
if (meta_rectangle_overlap (a, b))
|
||||
if (mtk_rectangle_overlap (a, b))
|
||||
{
|
||||
int new_y = MIN (a->y, b->y);
|
||||
a->height = MAX (a->y + a->height, b->y + b->height) - new_y;
|
||||
@ -443,7 +415,7 @@ check_strut_align (MetaStrut *strut, const MetaRectangle *rect)
|
||||
GList*
|
||||
meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
const MetaRectangle *basic_rect,
|
||||
const GSList *all_struts)
|
||||
const GSList *all_struts)
|
||||
{
|
||||
/* NOTE FOR OPTIMIZERS: This function *might* be somewhat slow,
|
||||
* especially due to the call to merge_spanning_rects_in_region() (which
|
||||
@ -514,7 +486,7 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
{
|
||||
MetaRectangle *rect = (MetaRectangle*) rect_iter->data;
|
||||
|
||||
if (!meta_rectangle_overlap (strut_rect, rect) ||
|
||||
if (!mtk_rectangle_overlap (strut_rect, rect) ||
|
||||
!check_strut_align (strut, basic_rect))
|
||||
ret = g_list_prepend (ret, rect);
|
||||
else
|
||||
@ -534,7 +506,7 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
temp_rect = g_new (MetaRectangle, 1);
|
||||
*temp_rect = *rect;
|
||||
new_x = BOX_RIGHT (*strut_rect);
|
||||
temp_rect->width = BOX_RIGHT(*rect) - new_x;
|
||||
temp_rect->width = BOX_RIGHT (*rect) - new_x;
|
||||
temp_rect->x = new_x;
|
||||
ret = g_list_prepend (ret, temp_rect);
|
||||
}
|
||||
@ -644,12 +616,12 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
|
||||
if (direction == META_DIRECTION_HORIZONTAL)
|
||||
{
|
||||
rect->x = expand_to->x;
|
||||
rect->width = expand_to->width;
|
||||
rect->x = expand_to->x;
|
||||
rect->width = expand_to->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect->y = expand_to->y;
|
||||
rect->y = expand_to->y;
|
||||
rect->height = expand_to->height;
|
||||
}
|
||||
|
||||
@ -660,20 +632,20 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
MetaStrut *strut = (MetaStrut*) strut_iter->data;
|
||||
|
||||
/* Skip struts that don't overlap */
|
||||
if (!meta_rectangle_overlap (&strut->rect, rect))
|
||||
if (!mtk_rectangle_overlap (&strut->rect, rect))
|
||||
continue;
|
||||
|
||||
if (direction == META_DIRECTION_HORIZONTAL)
|
||||
{
|
||||
if (strut->side == META_SIDE_LEFT)
|
||||
{
|
||||
int offset = BOX_RIGHT(strut->rect) - BOX_LEFT(*rect);
|
||||
rect->x += offset;
|
||||
int offset = BOX_RIGHT (strut->rect) - BOX_LEFT (*rect);
|
||||
rect->x += offset;
|
||||
rect->width -= offset;
|
||||
}
|
||||
else if (strut->side == META_SIDE_RIGHT)
|
||||
{
|
||||
int offset = BOX_RIGHT (*rect) - BOX_LEFT(strut->rect);
|
||||
int offset = BOX_RIGHT (*rect) - BOX_LEFT (strut->rect);
|
||||
rect->width -= offset;
|
||||
}
|
||||
/* else ignore the strut */
|
||||
@ -682,13 +654,13 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
{
|
||||
if (strut->side == META_SIDE_TOP)
|
||||
{
|
||||
int offset = BOX_BOTTOM(strut->rect) - BOX_TOP(*rect);
|
||||
rect->y += offset;
|
||||
int offset = BOX_BOTTOM (strut->rect) - BOX_TOP (*rect);
|
||||
rect->y += offset;
|
||||
rect->height -= offset;
|
||||
}
|
||||
else if (strut->side == META_SIDE_BOTTOM)
|
||||
{
|
||||
int offset = BOX_BOTTOM(*rect) - BOX_TOP(strut->rect);
|
||||
int offset = BOX_BOTTOM (*rect) - BOX_TOP (strut->rect);
|
||||
rect->height -= offset;
|
||||
}
|
||||
/* else ignore the strut */
|
||||
@ -743,13 +715,13 @@ meta_rectangle_overlaps_with_region (const GList *spanning_rects,
|
||||
const MetaRectangle *rect)
|
||||
{
|
||||
const GList *temp;
|
||||
gboolean overlaps;
|
||||
gboolean overlaps;
|
||||
|
||||
temp = spanning_rects;
|
||||
overlaps = FALSE;
|
||||
while (!overlaps && temp != NULL)
|
||||
{
|
||||
overlaps = overlaps || meta_rectangle_overlap (temp->data, rect);
|
||||
overlaps = overlaps || mtk_rectangle_overlap (temp->data, rect);
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
@ -1345,12 +1317,12 @@ edges_overlap (const MetaEdge *edge1,
|
||||
{
|
||||
if (edge1->rect.width == 0 && edge2->rect.width == 0)
|
||||
{
|
||||
return meta_rectangle_vert_overlap (&edge1->rect, &edge2->rect) &&
|
||||
return mtk_rectangle_vert_overlap (&edge1->rect, &edge2->rect) &&
|
||||
edge1->rect.x == edge2->rect.x;
|
||||
}
|
||||
else if (edge1->rect.height == 0 && edge2->rect.height == 0)
|
||||
{
|
||||
return meta_rectangle_horiz_overlap (&edge1->rect, &edge2->rect) &&
|
||||
return mtk_rectangle_horiz_overlap (&edge1->rect, &edge2->rect) &&
|
||||
edge1->rect.y == edge2->rect.y;
|
||||
}
|
||||
else
|
||||
@ -1491,7 +1463,7 @@ add_edges (GList *cur_edges,
|
||||
* edges to cur_list. Return cur_list when finished.
|
||||
*/
|
||||
static GList*
|
||||
split_edge (GList *cur_list,
|
||||
split_edge (GList *cur_list,
|
||||
const MetaEdge *old_edge,
|
||||
const MetaEdge *remove)
|
||||
{
|
||||
@ -1500,43 +1472,43 @@ split_edge (GList *cur_list,
|
||||
{
|
||||
case META_SIDE_LEFT:
|
||||
case META_SIDE_RIGHT:
|
||||
g_assert (meta_rectangle_vert_overlap (&old_edge->rect, &remove->rect));
|
||||
g_assert (mtk_rectangle_vert_overlap (&old_edge->rect, &remove->rect));
|
||||
if (BOX_TOP (old_edge->rect) < BOX_TOP (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.height = BOX_TOP (remove->rect)
|
||||
- BOX_TOP (old_edge->rect);
|
||||
- BOX_TOP (old_edge->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
if (BOX_BOTTOM (old_edge->rect) > BOX_BOTTOM (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.y = BOX_BOTTOM (remove->rect);
|
||||
temp_edge->rect.y = BOX_BOTTOM (remove->rect);
|
||||
temp_edge->rect.height = BOX_BOTTOM (old_edge->rect)
|
||||
- BOX_BOTTOM (remove->rect);
|
||||
- BOX_BOTTOM (remove->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
break;
|
||||
case META_SIDE_TOP:
|
||||
case META_SIDE_BOTTOM:
|
||||
g_assert (meta_rectangle_horiz_overlap (&old_edge->rect, &remove->rect));
|
||||
g_assert (mtk_rectangle_horiz_overlap (&old_edge->rect, &remove->rect));
|
||||
if (BOX_LEFT (old_edge->rect) < BOX_LEFT (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.width = BOX_LEFT (remove->rect)
|
||||
- BOX_LEFT (old_edge->rect);
|
||||
- BOX_LEFT (old_edge->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
if (BOX_RIGHT (old_edge->rect) > BOX_RIGHT (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.x = BOX_RIGHT (remove->rect);
|
||||
temp_edge->rect.x = BOX_RIGHT (remove->rect);
|
||||
temp_edge->rect.width = BOX_RIGHT (old_edge->rect)
|
||||
- BOX_RIGHT (remove->rect);
|
||||
- BOX_RIGHT (remove->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
break;
|
||||
@ -1757,8 +1729,8 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
|
||||
*/
|
||||
GList*
|
||||
meta_rectangle_find_nonintersected_monitor_edges (
|
||||
const GList *monitor_rects,
|
||||
const GSList *all_struts)
|
||||
const GList *monitor_rects,
|
||||
const GSList *all_struts)
|
||||
{
|
||||
/* This function cannot easily be merged with
|
||||
* meta_rectangle_find_onscreen_edges() because real screen edges
|
||||
@ -1785,13 +1757,13 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
MetaRectangle *compare_rect = compare->data;
|
||||
|
||||
/* Check if cur might be horizontally adjacent to compare */
|
||||
if (meta_rectangle_vert_overlap(cur_rect, compare_rect))
|
||||
if (mtk_rectangle_vert_overlap (cur_rect, compare_rect))
|
||||
{
|
||||
MetaSide side_type;
|
||||
int y = MAX (cur_rect->y, compare_rect->y);
|
||||
int y = MAX (cur_rect->y, compare_rect->y);
|
||||
int height = MIN (BOX_BOTTOM (*cur_rect) - y,
|
||||
BOX_BOTTOM (*compare_rect) - y);
|
||||
int width = 0;
|
||||
int width = 0;
|
||||
int x;
|
||||
|
||||
if (BOX_LEFT (*cur_rect) == BOX_RIGHT (*compare_rect))
|
||||
@ -1817,7 +1789,7 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
* a right edge for the monitor on the left. Just fill
|
||||
* up the edges and stick 'em on the list.
|
||||
*/
|
||||
MetaEdge *new_edge = g_new (MetaEdge, 1);
|
||||
MetaEdge *new_edge = g_new (MetaEdge, 1);
|
||||
|
||||
new_edge->rect = MTK_RECTANGLE_INIT (x, y, width, height);
|
||||
new_edge->side_type = side_type;
|
||||
@ -1828,12 +1800,12 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
}
|
||||
|
||||
/* Check if cur might be vertically adjacent to compare */
|
||||
if (meta_rectangle_horiz_overlap(cur_rect, compare_rect))
|
||||
if (mtk_rectangle_horiz_overlap (cur_rect, compare_rect))
|
||||
{
|
||||
MetaSide side_type;
|
||||
int x = MAX (cur_rect->x, compare_rect->x);
|
||||
int width = MIN (BOX_RIGHT (*cur_rect) - x,
|
||||
BOX_RIGHT (*compare_rect) - x);
|
||||
int x = MAX (cur_rect->x, compare_rect->x);
|
||||
int width = MIN (BOX_RIGHT (*cur_rect) - x,
|
||||
BOX_RIGHT (*compare_rect) - x);
|
||||
int height = 0;
|
||||
int y;
|
||||
|
||||
|
@ -3242,8 +3242,8 @@ check_fullscreen_func (gpointer data)
|
||||
{
|
||||
MetaLogicalMonitor *logical_monitor = l->data;
|
||||
|
||||
if (meta_rectangle_overlap (&window_rect,
|
||||
&logical_monitor->rect) &&
|
||||
if (mtk_rectangle_overlap (&window_rect,
|
||||
&logical_monitor->rect) &&
|
||||
!g_slist_find (fullscreen_monitors, logical_monitor) &&
|
||||
!g_slist_find (obscured_monitors, logical_monitor))
|
||||
fullscreen_monitors = g_slist_prepend (fullscreen_monitors,
|
||||
|
@ -2021,7 +2021,7 @@ windows_overlap (const MetaWindow *w1, const MetaWindow *w2)
|
||||
MetaRectangle w1rect, w2rect;
|
||||
meta_window_get_frame_rect (w1, &w1rect);
|
||||
meta_window_get_frame_rect (w2, &w2rect);
|
||||
return meta_rectangle_overlap (&w1rect, &w2rect);
|
||||
return mtk_rectangle_overlap (&w1rect, &w2rect);
|
||||
}
|
||||
|
||||
/* Returns whether a new window would be covered by any
|
||||
@ -4118,7 +4118,7 @@ meta_window_move_to_monitor (MetaWindow *window,
|
||||
|
||||
if (window->unconstrained_rect.width == 0 ||
|
||||
window->unconstrained_rect.height == 0 ||
|
||||
!meta_rectangle_overlap (&window->unconstrained_rect, &old_area))
|
||||
!mtk_rectangle_overlap (&window->unconstrained_rect, &old_area))
|
||||
{
|
||||
meta_window_move_between_rects (window, 0, NULL, &new_area);
|
||||
}
|
||||
@ -6379,7 +6379,7 @@ meta_window_set_demands_attention (MetaWindow *window)
|
||||
{
|
||||
meta_window_get_frame_rect (other_window, &other_rect);
|
||||
|
||||
if (meta_rectangle_overlap (&candidate_rect, &other_rect))
|
||||
if (mtk_rectangle_overlap (&candidate_rect, &other_rect))
|
||||
{
|
||||
obscured = TRUE;
|
||||
break;
|
||||
@ -7218,8 +7218,8 @@ meta_window_find_tile_match (MetaWindow *window,
|
||||
|
||||
meta_window_get_frame_rect (above, &above_rect);
|
||||
|
||||
if (meta_rectangle_overlap (&above_rect, &bottommost_rect) &&
|
||||
meta_rectangle_overlap (&above_rect, &topmost_rect))
|
||||
if (mtk_rectangle_overlap (&above_rect, &bottommost_rect) &&
|
||||
mtk_rectangle_overlap (&above_rect, &topmost_rect))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -101,26 +101,6 @@ MetaRectangle *meta_rectangle_copy (const MetaRectangle *rect);
|
||||
META_EXPORT
|
||||
void meta_rectangle_free (MetaRectangle *rect);
|
||||
|
||||
/* overlap is similar to intersect but doesn't provide location of
|
||||
* intersection information.
|
||||
*/
|
||||
META_EXPORT
|
||||
gboolean meta_rectangle_overlap (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2);
|
||||
|
||||
/* vert_overlap means ignore the horizontal location and ask if the
|
||||
* vertical parts overlap. An alternate way to think of it is "Does there
|
||||
* exist a way to shift either rect horizontally so that the two rects
|
||||
* overlap?" horiz_overlap is similar.
|
||||
*/
|
||||
META_EXPORT
|
||||
gboolean meta_rectangle_vert_overlap (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2);
|
||||
|
||||
META_EXPORT
|
||||
gboolean meta_rectangle_horiz_overlap (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2);
|
||||
|
||||
/* could_fit_rect determines whether "outer_rect" is big enough to contain
|
||||
* inner_rect. contains_rect checks whether it actually contains it.
|
||||
*/
|
||||
|
@ -169,16 +169,16 @@ test_overlap_funcs (void)
|
||||
{
|
||||
get_random_rect (&temp1);
|
||||
get_random_rect (&temp2);
|
||||
g_assert (meta_rectangle_overlap (&temp1, &temp2) ==
|
||||
(meta_rectangle_horiz_overlap (&temp1, &temp2) &&
|
||||
meta_rectangle_vert_overlap (&temp1, &temp2)));
|
||||
g_assert (mtk_rectangle_overlap (&temp1, &temp2) ==
|
||||
(mtk_rectangle_horiz_overlap (&temp1, &temp2) &&
|
||||
mtk_rectangle_vert_overlap (&temp1, &temp2)));
|
||||
}
|
||||
|
||||
temp1 = MTK_RECTANGLE_INIT ( 0, 0, 10, 10);
|
||||
temp2 = MTK_RECTANGLE_INIT (20, 0, 10, 5);
|
||||
g_assert (!meta_rectangle_overlap (&temp1, &temp2));
|
||||
g_assert (!meta_rectangle_horiz_overlap (&temp1, &temp2));
|
||||
g_assert ( meta_rectangle_vert_overlap (&temp1, &temp2));
|
||||
g_assert (!mtk_rectangle_overlap (&temp1, &temp2));
|
||||
g_assert (!mtk_rectangle_horiz_overlap (&temp1, &temp2));
|
||||
g_assert (mtk_rectangle_vert_overlap (&temp1, &temp2));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -418,7 +418,7 @@ test_merge_regions (void)
|
||||
else if (a->y == b->y && a->height == b->height)
|
||||
{
|
||||
/* If a and b overlap */
|
||||
if (meta_rectangle_overlap (a, b))
|
||||
if (mtk_rectangle_overlap (a, b))
|
||||
{
|
||||
int new_x = MIN (a->x, b->x);
|
||||
a->width = MAX (a->x + a->width, b->x + b->width) - new_x;
|
||||
@ -442,7 +442,7 @@ test_merge_regions (void)
|
||||
else if (a->x == b->x && a->width == b->width)
|
||||
{
|
||||
/* If a and b overlap */
|
||||
if (meta_rectangle_overlap (a, b))
|
||||
if (mtk_rectangle_overlap (a, b))
|
||||
{
|
||||
int new_y = MIN (a->y, b->y);
|
||||
a->height = MAX (a->y + a->height, b->y + b->height) - new_y;
|
||||
@ -806,7 +806,7 @@ rect_overlaps_region (const GList *spanning_rects,
|
||||
overlaps = FALSE;
|
||||
while (!overlaps && temp != NULL)
|
||||
{
|
||||
overlaps = overlaps || meta_rectangle_overlap (temp->data, rect);
|
||||
overlaps = overlaps || mtk_rectangle_overlap (temp->data, rect);
|
||||
temp = temp->next;
|
||||
}
|
||||
|
||||
|
@ -346,8 +346,8 @@ meta_wayland_actor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *surfac
|
||||
|
||||
clutter_stage_view_get_layout (stage_view, &view_layout);
|
||||
|
||||
if (meta_rectangle_overlap (&logical_monitor_layout,
|
||||
&view_layout) &&
|
||||
if (mtk_rectangle_overlap (&logical_monitor_layout,
|
||||
&view_layout) &&
|
||||
clutter_actor_is_effectively_on_stage_view (CLUTTER_ACTOR (actor),
|
||||
stage_view))
|
||||
return TRUE;
|
||||
|
@ -1358,7 +1358,7 @@ meta_wayland_xdg_popup_post_apply_state (MetaWaylandSurfaceRole *surface_role,
|
||||
parent_window = meta_wayland_surface_get_window (xdg_popup->parent_surface);
|
||||
meta_window_get_buffer_rect (window, &buffer_rect);
|
||||
meta_window_get_buffer_rect (parent_window, &parent_buffer_rect);
|
||||
if (!meta_rectangle_overlap (&buffer_rect, &parent_buffer_rect) &&
|
||||
if (!mtk_rectangle_overlap (&buffer_rect, &parent_buffer_rect) &&
|
||||
!meta_rectangle_is_adjacent_to (&buffer_rect, &parent_buffer_rect))
|
||||
{
|
||||
g_warning ("Buggy client caused popup to be placed outside of "
|
||||
|
Loading…
Reference in New Issue
Block a user