mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 21:32:14 +00:00
mtk: Move Rectangle.intersect from Meta
Also replaces it usage everywhere & remove the Clutter helper. Note the tests were not moved yet to mtk. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
This commit is contained in:
parent
6f66dd9944
commit
565acaed9c
@ -214,10 +214,6 @@ void _clutter_util_rectangle_offset (const MtkRectangle *src,
|
|||||||
int y,
|
int y,
|
||||||
MtkRectangle *dest);
|
MtkRectangle *dest);
|
||||||
|
|
||||||
gboolean _clutter_util_rectangle_intersection (const MtkRectangle *src1,
|
|
||||||
const MtkRectangle *src2,
|
|
||||||
MtkRectangle *dest);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
|
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ find_damaged_tiles (ClutterStageView *view,
|
|||||||
CAIRO_REGION_OVERLAP_OUT)
|
CAIRO_REGION_OVERLAP_OUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_clutter_util_rectangle_intersection (&tile, &fb_rect, &tile);
|
mtk_rectangle_intersect (&tile, &fb_rect, &tile);
|
||||||
|
|
||||||
if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
|
if (is_tile_dirty (&tile, current_data, prev_data, bpp, stride))
|
||||||
cairo_region_union_rectangle (tile_damage_region, &tile);
|
cairo_region_union_rectangle (tile_damage_region, &tile);
|
||||||
|
@ -263,8 +263,8 @@ clutter_stage_add_redraw_clip (ClutterStage *stage,
|
|||||||
MtkRectangle intersection;
|
MtkRectangle intersection;
|
||||||
|
|
||||||
clutter_stage_view_get_layout (view, &view_layout);
|
clutter_stage_view_get_layout (view, &view_layout);
|
||||||
if (_clutter_util_rectangle_intersection (&view_layout, clip,
|
if (mtk_rectangle_intersect (&view_layout, clip,
|
||||||
&intersection))
|
&intersection))
|
||||||
clutter_stage_view_add_redraw_clip (view, &intersection);
|
clutter_stage_view_add_redraw_clip (view, &intersection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,39 +163,6 @@ _clutter_util_rectangle_offset (const MtkRectangle *src,
|
|||||||
dest->y += y;
|
dest->y += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
_clutter_util_rectangle_intersection (const MtkRectangle *src1,
|
|
||||||
const MtkRectangle *src2,
|
|
||||||
MtkRectangle *dest)
|
|
||||||
{
|
|
||||||
int x1, y1, x2, y2;
|
|
||||||
|
|
||||||
x1 = MAX (src1->x, src2->x);
|
|
||||||
y1 = MAX (src1->y, src2->y);
|
|
||||||
|
|
||||||
x2 = MIN (src1->x + (int) src1->width, src2->x + (int) src2->width);
|
|
||||||
y2 = MIN (src1->y + (int) src1->height, src2->y + (int) src2->height);
|
|
||||||
|
|
||||||
if (x1 >= x2 || y1 >= y2)
|
|
||||||
{
|
|
||||||
dest->x = 0;
|
|
||||||
dest->y = 0;
|
|
||||||
dest->width = 0;
|
|
||||||
dest->height = 0;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dest->x = x1;
|
|
||||||
dest->y = y1;
|
|
||||||
dest->width = x2 - x1;
|
|
||||||
dest->height = y2 - y1;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GType value_type;
|
GType value_type;
|
||||||
|
@ -98,3 +98,52 @@ mtk_rectangle_union (const MtkRectangle *rect1,
|
|||||||
dest->width = dest_w;
|
dest->width = dest_w;
|
||||||
dest->height = dest_h;
|
dest->height = dest_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mtk_rectangle_intersect:
|
||||||
|
* @src1: a #MtkRectangle
|
||||||
|
* @src2: another #MtkRectangle
|
||||||
|
* @dest: (out caller-allocates): an empty #MtkRectangle, to be filled
|
||||||
|
* with the coordinates of the intersection.
|
||||||
|
*
|
||||||
|
* Find the intersection between the two rectangles
|
||||||
|
*
|
||||||
|
* Returns: TRUE is some intersection exists and is not degenerate, FALSE
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
mtk_rectangle_intersect (const MtkRectangle *src1,
|
||||||
|
const MtkRectangle *src2,
|
||||||
|
MtkRectangle *dest)
|
||||||
|
{
|
||||||
|
int dest_x, dest_y;
|
||||||
|
int dest_w, dest_h;
|
||||||
|
int return_val;
|
||||||
|
|
||||||
|
g_return_val_if_fail (src1 != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (src2 != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (dest != NULL, FALSE);
|
||||||
|
|
||||||
|
return_val = FALSE;
|
||||||
|
|
||||||
|
dest_x = MAX (src1->x, src2->x);
|
||||||
|
dest_y = MAX (src1->y, src2->y);
|
||||||
|
dest_w = MIN (src1->x + src1->width, src2->x + src2->width) - dest_x;
|
||||||
|
dest_h = MIN (src1->y + src1->height, src2->y + src2->height) - dest_y;
|
||||||
|
|
||||||
|
if (dest_w > 0 && dest_h > 0)
|
||||||
|
{
|
||||||
|
dest->x = dest_x;
|
||||||
|
dest->y = dest_y;
|
||||||
|
dest->width = dest_w;
|
||||||
|
dest->height = dest_h;
|
||||||
|
return_val = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dest->width = 0;
|
||||||
|
dest->height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return return_val;
|
||||||
|
}
|
||||||
|
@ -74,3 +74,8 @@ void mtk_rectangle_union (const MtkRectangle *rect1,
|
|||||||
const MtkRectangle *rect2,
|
const MtkRectangle *rect2,
|
||||||
MtkRectangle *dest);
|
MtkRectangle *dest);
|
||||||
|
|
||||||
|
MTK_EXPORT
|
||||||
|
gboolean mtk_rectangle_intersect (const MtkRectangle *src1,
|
||||||
|
const MtkRectangle *src2,
|
||||||
|
MtkRectangle *dest);
|
||||||
|
|
||||||
|
@ -3369,9 +3369,9 @@ meta_monitor_manager_get_logical_monitor_from_rect (MetaMonitorManager *manager,
|
|||||||
if (META_POINT_IN_RECT (center_x, center_y, logical_monitor->rect))
|
if (META_POINT_IN_RECT (center_x, center_y, logical_monitor->rect))
|
||||||
return logical_monitor;
|
return logical_monitor;
|
||||||
|
|
||||||
if (!meta_rectangle_intersect (&logical_monitor->rect,
|
if (!mtk_rectangle_intersect (&logical_monitor->rect,
|
||||||
rect,
|
rect,
|
||||||
&intersection))
|
&intersection))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
intersection_area = meta_rectangle_area (&intersection);
|
intersection_area = meta_rectangle_area (&intersection);
|
||||||
@ -3413,9 +3413,9 @@ meta_monitor_manager_get_highest_scale_monitor_from_rect (MetaMonitorManager *ma
|
|||||||
MetaRectangle intersection;
|
MetaRectangle intersection;
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
if (!meta_rectangle_intersect (&logical_monitor->rect,
|
if (!mtk_rectangle_intersect (&logical_monitor->rect,
|
||||||
rect,
|
rect,
|
||||||
&intersection))
|
&intersection))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
scale = meta_logical_monitor_get_scale (logical_monitor);
|
scale = meta_logical_monitor_get_scale (logical_monitor);
|
||||||
|
@ -323,7 +323,7 @@ meta_screen_cast_window_stream_src_get_videocrop (MetaScreenCastStreamSrc *src,
|
|||||||
stream_rect.width = get_stream_width (window_src);
|
stream_rect.width = get_stream_width (window_src);
|
||||||
stream_rect.height = get_stream_height (window_src);
|
stream_rect.height = get_stream_height (window_src);
|
||||||
|
|
||||||
meta_rectangle_intersect (crop_rect, &stream_rect, crop_rect);
|
mtk_rectangle_intersect (crop_rect, &stream_rect, crop_rect);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ queue_redraw_clutter_rect (MetaStage *stage,
|
|||||||
|
|
||||||
clutter_stage_view_get_layout (view, &view_layout);
|
clutter_stage_view_get_layout (view, &view_layout);
|
||||||
|
|
||||||
if (meta_rectangle_intersect (&clip, &view_layout, &view_clip))
|
if (mtk_rectangle_intersect (&clip, &view_layout, &view_clip))
|
||||||
{
|
{
|
||||||
clutter_stage_view_add_redraw_clip (view, &view_clip);
|
clutter_stage_view_add_redraw_clip (view, &view_clip);
|
||||||
clutter_stage_view_schedule_update (view);
|
clutter_stage_view_schedule_update (view);
|
||||||
|
@ -966,9 +966,9 @@ compute_resistance_and_snapping_edges (MetaWindowDrag *window_drag)
|
|||||||
* is offscreen (we also don't care about parts of edges covered
|
* is offscreen (we also don't care about parts of edges covered
|
||||||
* by other windows or DOCKS, but that's handled below).
|
* by other windows or DOCKS, but that's handled below).
|
||||||
*/
|
*/
|
||||||
meta_rectangle_intersect (&cur_rect,
|
mtk_rectangle_intersect (&cur_rect,
|
||||||
&display_rect,
|
&display_rect,
|
||||||
&reduced);
|
&reduced);
|
||||||
|
|
||||||
new_edges = NULL;
|
new_edges = NULL;
|
||||||
|
|
||||||
|
@ -847,7 +847,7 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
MtkRectangle rect;
|
MtkRectangle rect;
|
||||||
cairo_region_get_rectangle (blended_tex_region, i, &rect);
|
cairo_region_get_rectangle (blended_tex_region, i, &rect);
|
||||||
|
|
||||||
if (!meta_rectangle_intersect (&content_rect, &rect, &rect))
|
if (!mtk_rectangle_intersect (&content_rect, &rect, &rect))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
paint_clipped_rectangle_node (stex, root_node,
|
paint_clipped_rectangle_node (stex, root_node,
|
||||||
@ -1036,7 +1036,7 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
|||||||
.height = stex->tex_height,
|
.height = stex->tex_height,
|
||||||
};
|
};
|
||||||
|
|
||||||
meta_rectangle_intersect (&buffer_rect, clip, clip);
|
mtk_rectangle_intersect (&buffer_rect, clip, clip);
|
||||||
|
|
||||||
meta_rectangle_scale_double (clip,
|
meta_rectangle_scale_double (clip,
|
||||||
1.0 / stex->buffer_scale,
|
1.0 / stex->buffer_scale,
|
||||||
@ -1448,8 +1448,8 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
|
|||||||
.height = stex->dst_height,
|
.height = stex->dst_height,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!meta_rectangle_intersect (&dst_rect, clip,
|
if (!mtk_rectangle_intersect (&dst_rect, clip,
|
||||||
image_clip))
|
image_clip))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
*image_clip = (MetaRectangle) {
|
*image_clip = (MetaRectangle) {
|
||||||
|
@ -1697,9 +1697,9 @@ meta_window_actor_get_image (MetaWindowActor *self,
|
|||||||
tmp_clip = *clip;
|
tmp_clip = *clip;
|
||||||
tmp_clip.x += floorf (x);
|
tmp_clip.x += floorf (x);
|
||||||
tmp_clip.y += floorf (y);
|
tmp_clip.y += floorf (y);
|
||||||
if (!meta_rectangle_intersect (&framebuffer_clip,
|
if (!mtk_rectangle_intersect (&framebuffer_clip,
|
||||||
&tmp_clip,
|
&tmp_clip,
|
||||||
&intersected_clip))
|
&intersected_clip))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
framebuffer_clip = intersected_clip;
|
framebuffer_clip = intersected_clip;
|
||||||
@ -1779,7 +1779,7 @@ meta_window_actor_paint_to_content (MetaWindowActor *self,
|
|||||||
{
|
{
|
||||||
MetaRectangle tmp_clip;
|
MetaRectangle tmp_clip;
|
||||||
|
|
||||||
if (!meta_rectangle_intersect (&framebuffer_clip, clip, &tmp_clip))
|
if (!mtk_rectangle_intersect (&framebuffer_clip, clip, &tmp_clip))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
framebuffer_clip = tmp_clip;
|
framebuffer_clip = tmp_clip;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2005, 2006 Elijah Newren
|
* Copyright (C) 2005, 2006 Elijah Newren
|
||||||
* [meta_rectangle_intersect() is copyright the GTK+ Team according to Havoc,
|
* [mtk_rectangle_intersect() is copyright the GTK+ Team according to Havoc,
|
||||||
* see gdkrectangle.c. As far as Havoc knows, he probably wrote
|
* see gdkrectangle.c. As far as Havoc knows, he probably wrote
|
||||||
* mtk_rectangle_equal(), and I'm guessing it's (C) Red Hat. So...]
|
* mtk_rectangle_equal(), and I'm guessing it's (C) Red Hat. So...]
|
||||||
* Copyright (C) 1995-2000 GTK+ Team
|
* Copyright (C) 1995-2000 GTK+ Team
|
||||||
@ -153,53 +153,6 @@ meta_rectangle_area (const MetaRectangle *rect)
|
|||||||
return rect->width * rect->height;
|
return rect->width * rect->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* meta_rectangle_intersect:
|
|
||||||
* @src1: a #MetaRectangle
|
|
||||||
* @src2: another #MetaRectangle
|
|
||||||
* @dest: (out caller-allocates): an empty #MetaRectangle, to be filled
|
|
||||||
* with the coordinates of the intersection.
|
|
||||||
*
|
|
||||||
* Returns: TRUE is some intersection exists and is not degenerate, FALSE
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
meta_rectangle_intersect (const MetaRectangle *src1,
|
|
||||||
const MetaRectangle *src2,
|
|
||||||
MetaRectangle *dest)
|
|
||||||
{
|
|
||||||
int dest_x, dest_y;
|
|
||||||
int dest_w, dest_h;
|
|
||||||
int return_val;
|
|
||||||
|
|
||||||
g_return_val_if_fail (src1 != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (src2 != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (dest != NULL, FALSE);
|
|
||||||
|
|
||||||
return_val = FALSE;
|
|
||||||
|
|
||||||
dest_x = MAX (src1->x, src2->x);
|
|
||||||
dest_y = MAX (src1->y, src2->y);
|
|
||||||
dest_w = MIN (src1->x + src1->width, src2->x + src2->width) - dest_x;
|
|
||||||
dest_h = MIN (src1->y + src1->height, src2->y + src2->height) - dest_y;
|
|
||||||
|
|
||||||
if (dest_w > 0 && dest_h > 0)
|
|
||||||
{
|
|
||||||
dest->x = dest_x;
|
|
||||||
dest->y = dest_y;
|
|
||||||
dest->width = dest_w;
|
|
||||||
dest->height = dest_h;
|
|
||||||
return_val = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dest->width = 0;
|
|
||||||
dest->height = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return return_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_rectangle_overlap (const MetaRectangle *rect1,
|
meta_rectangle_overlap (const MetaRectangle *rect1,
|
||||||
const MetaRectangle *rect2)
|
const MetaRectangle *rect2)
|
||||||
@ -948,7 +901,7 @@ meta_rectangle_clip_to_region (const GList *spanning_rects,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Determine maximal overlap amount */
|
/* Determine maximal overlap amount */
|
||||||
meta_rectangle_intersect (rect, compare_rect, &overlap);
|
mtk_rectangle_intersect (rect, compare_rect, &overlap);
|
||||||
maximal_overlap_amount_for_compare = meta_rectangle_area (&overlap);
|
maximal_overlap_amount_for_compare = meta_rectangle_area (&overlap);
|
||||||
|
|
||||||
/* See if this is the best rect so far */
|
/* See if this is the best rect so far */
|
||||||
@ -1282,7 +1235,7 @@ get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
|
|||||||
MetaRectangle *cur = &((MetaStrut*)old_struts->data)->rect;
|
MetaRectangle *cur = &((MetaStrut*)old_struts->data)->rect;
|
||||||
MetaRectangle *copy = g_new (MetaRectangle, 1);
|
MetaRectangle *copy = g_new (MetaRectangle, 1);
|
||||||
*copy = *cur;
|
*copy = *cur;
|
||||||
if (meta_rectangle_intersect (copy, region, copy))
|
if (mtk_rectangle_intersect (copy, region, copy))
|
||||||
strut_rects = g_list_prepend (strut_rects, copy);
|
strut_rects = g_list_prepend (strut_rects, copy);
|
||||||
else
|
else
|
||||||
g_free (copy);
|
g_free (copy);
|
||||||
@ -1306,7 +1259,7 @@ get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
|
|||||||
MetaRectangle *comp = compare->data;
|
MetaRectangle *comp = compare->data;
|
||||||
MetaRectangle overlap;
|
MetaRectangle overlap;
|
||||||
|
|
||||||
if (meta_rectangle_intersect (cur, comp, &overlap))
|
if (mtk_rectangle_intersect (cur, comp, &overlap))
|
||||||
{
|
{
|
||||||
/* Get a list of rectangles for each strut that don't overlap
|
/* Get a list of rectangles for each strut that don't overlap
|
||||||
* the intersection region.
|
* the intersection region.
|
||||||
|
@ -838,8 +838,8 @@ try_flip_window_position (MetaWindow *window,
|
|||||||
&flipped_rel_x, &flipped_rel_y);
|
&flipped_rel_x, &flipped_rel_y);
|
||||||
flipped_rect.x = parent_x + flipped_rel_x;
|
flipped_rect.x = parent_x + flipped_rel_x;
|
||||||
flipped_rect.y = parent_y + flipped_rel_y;
|
flipped_rect.y = parent_y + flipped_rel_y;
|
||||||
meta_rectangle_intersect (&flipped_rect, &info->work_area_monitor,
|
mtk_rectangle_intersect (&flipped_rect, &info->work_area_monitor,
|
||||||
&flipped_intersection);
|
&flipped_intersection);
|
||||||
|
|
||||||
if ((constraint_adjustment == META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_X &&
|
if ((constraint_adjustment == META_PLACEMENT_CONSTRAINT_ADJUSTMENT_FLIP_X &&
|
||||||
flipped_intersection.width == flipped_rect.width) ||
|
flipped_intersection.width == flipped_rect.width) ||
|
||||||
@ -966,8 +966,8 @@ constrain_custom_rule (MetaWindow *window,
|
|||||||
adjusted_rel_y = window->placement.current.rel_y;
|
adjusted_rel_y = window->placement.current.rel_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_rectangle_intersect (&adjusted_unconstrained, &info->work_area_monitor,
|
mtk_rectangle_intersect (&adjusted_unconstrained, &info->work_area_monitor,
|
||||||
&intersection);
|
&intersection);
|
||||||
|
|
||||||
constraint_satisfied = (mtk_rectangle_equal (&info->current,
|
constraint_satisfied = (mtk_rectangle_equal (&info->current,
|
||||||
&adjusted_unconstrained) &&
|
&adjusted_unconstrained) &&
|
||||||
@ -1034,8 +1034,8 @@ constrain_custom_rule (MetaWindow *window,
|
|||||||
&intersection);
|
&intersection);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_rectangle_intersect (&info->current, &info->work_area_monitor,
|
mtk_rectangle_intersect (&info->current, &info->work_area_monitor,
|
||||||
&intersection);
|
&intersection);
|
||||||
constraint_satisfied = is_custom_rule_satisfied (&info->current,
|
constraint_satisfied = is_custom_rule_satisfied (&info->current,
|
||||||
placement_rule,
|
placement_rule,
|
||||||
&intersection);
|
&intersection);
|
||||||
@ -1100,8 +1100,8 @@ constrain_custom_rule (MetaWindow *window,
|
|||||||
info->current.y = new_y;
|
info->current.y = new_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_rectangle_intersect (&info->current, &info->work_area_monitor,
|
mtk_rectangle_intersect (&info->current, &info->work_area_monitor,
|
||||||
&intersection);
|
&intersection);
|
||||||
constraint_satisfied = is_custom_rule_satisfied (&info->current,
|
constraint_satisfied = is_custom_rule_satisfied (&info->current,
|
||||||
placement_rule,
|
placement_rule,
|
||||||
&intersection);
|
&intersection);
|
||||||
|
@ -2934,7 +2934,7 @@ handle_raise_or_lower (MetaDisplay *display,
|
|||||||
meta_window_get_frame_rect (above, &above_rect);
|
meta_window_get_frame_rect (above, &above_rect);
|
||||||
|
|
||||||
/* Check if obscured */
|
/* Check if obscured */
|
||||||
if (meta_rectangle_intersect (&win_rect, &above_rect, &tmp))
|
if (mtk_rectangle_intersect (&win_rect, &above_rect, &tmp))
|
||||||
{
|
{
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
return;
|
return;
|
||||||
|
@ -365,9 +365,9 @@ window_overlaps_focus_window (MetaWindow *window)
|
|||||||
meta_window_get_frame_rect (window, &window_frame);
|
meta_window_get_frame_rect (window, &window_frame);
|
||||||
meta_window_get_frame_rect (focus_window, &focus_frame);
|
meta_window_get_frame_rect (focus_window, &focus_frame);
|
||||||
|
|
||||||
return meta_rectangle_intersect (&window_frame,
|
return mtk_rectangle_intersect (&window_frame,
|
||||||
&focus_frame,
|
&focus_frame,
|
||||||
&overlap);
|
&overlap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -458,7 +458,7 @@ rectangle_overlaps_some_window (MetaRectangle *rect,
|
|||||||
case META_WINDOW_MENU:
|
case META_WINDOW_MENU:
|
||||||
meta_window_get_frame_rect (other, &other_rect);
|
meta_window_get_frame_rect (other, &other_rect);
|
||||||
|
|
||||||
if (meta_rectangle_intersect (rect, &other_rect, &dest))
|
if (mtk_rectangle_intersect (rect, &other_rect, &dest))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5800,7 +5800,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window)
|
|||||||
MetaRectangle *spanning_rect = onscreen_region->data;
|
MetaRectangle *spanning_rect = onscreen_region->data;
|
||||||
MetaRectangle overlap;
|
MetaRectangle overlap;
|
||||||
|
|
||||||
meta_rectangle_intersect (&titlebar_rect, spanning_rect, &overlap);
|
mtk_rectangle_intersect (&titlebar_rect, spanning_rect, &overlap);
|
||||||
if (overlap.height > MIN (titlebar_rect.height, min_height_needed) &&
|
if (overlap.height > MIN (titlebar_rect.height, min_height_needed) &&
|
||||||
overlap.width > MIN (titlebar_rect.width * min_width_percent,
|
overlap.width > MIN (titlebar_rect.width * min_width_percent,
|
||||||
min_width_absolute))
|
min_width_absolute))
|
||||||
@ -5834,9 +5834,9 @@ meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
|||||||
meta_workspace_get_work_area_for_logical_monitor (tmp->data,
|
meta_workspace_get_work_area_for_logical_monitor (tmp->data,
|
||||||
logical_monitor,
|
logical_monitor,
|
||||||
&workspace_work_area);
|
&workspace_work_area);
|
||||||
meta_rectangle_intersect (area,
|
mtk_rectangle_intersect (area,
|
||||||
&workspace_work_area,
|
&workspace_work_area,
|
||||||
area);
|
area);
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5916,9 +5916,9 @@ meta_window_get_work_area_all_monitors (MetaWindow *window,
|
|||||||
MetaRectangle workspace_work_area;
|
MetaRectangle workspace_work_area;
|
||||||
meta_workspace_get_work_area_all_monitors (tmp->data,
|
meta_workspace_get_work_area_all_monitors (tmp->data,
|
||||||
&workspace_work_area);
|
&workspace_work_area);
|
||||||
meta_rectangle_intersect (area,
|
mtk_rectangle_intersect (area,
|
||||||
&workspace_work_area,
|
&workspace_work_area,
|
||||||
area);
|
area);
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,11 +117,6 @@ MetaRectangle meta_rect (int x, int y, int width, int height);
|
|||||||
META_EXPORT
|
META_EXPORT
|
||||||
int meta_rectangle_area (const MetaRectangle *rect);
|
int meta_rectangle_area (const MetaRectangle *rect);
|
||||||
|
|
||||||
META_EXPORT
|
|
||||||
gboolean meta_rectangle_intersect (const MetaRectangle *src1,
|
|
||||||
const MetaRectangle *src2,
|
|
||||||
MetaRectangle *dest);
|
|
||||||
|
|
||||||
/* overlap is similar to intersect but doesn't provide location of
|
/* overlap is similar to intersect but doesn't provide location of
|
||||||
* intersection information.
|
* intersection information.
|
||||||
*/
|
*/
|
||||||
|
@ -141,18 +141,18 @@ test_intersect (void)
|
|||||||
MetaRectangle temp;
|
MetaRectangle temp;
|
||||||
MetaRectangle temp2;
|
MetaRectangle temp2;
|
||||||
|
|
||||||
meta_rectangle_intersect (&a, &b, &temp);
|
mtk_rectangle_intersect (&a, &b, &temp);
|
||||||
temp2 = meta_rect (100, 200, 10, 2);
|
temp2 = meta_rect (100, 200, 10, 2);
|
||||||
g_assert (mtk_rectangle_equal (&temp, &temp2));
|
g_assert (mtk_rectangle_equal (&temp, &temp2));
|
||||||
g_assert (meta_rectangle_area (&temp) == 20);
|
g_assert (meta_rectangle_area (&temp) == 20);
|
||||||
|
|
||||||
meta_rectangle_intersect (&a, &c, &temp);
|
mtk_rectangle_intersect (&a, &c, &temp);
|
||||||
g_assert (meta_rectangle_area (&temp) == 0);
|
g_assert (meta_rectangle_area (&temp) == 0);
|
||||||
|
|
||||||
meta_rectangle_intersect (&a, &d, &temp);
|
mtk_rectangle_intersect (&a, &d, &temp);
|
||||||
g_assert (meta_rectangle_area (&temp) == 0);
|
g_assert (meta_rectangle_area (&temp) == 0);
|
||||||
|
|
||||||
meta_rectangle_intersect (&b, &d, &b);
|
mtk_rectangle_intersect (&b, &d, &b);
|
||||||
g_assert (mtk_rectangle_equal (&b, &b_intersect_d));
|
g_assert (mtk_rectangle_equal (&b, &b_intersect_d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ meta_wayland_shell_surface_determine_geometry (MetaWaylandShellSurface *shell_su
|
|||||||
meta_wayland_shell_surface_calculate_geometry (shell_surface,
|
meta_wayland_shell_surface_calculate_geometry (shell_surface,
|
||||||
&bounding_geometry);
|
&bounding_geometry);
|
||||||
|
|
||||||
meta_rectangle_intersect (set_geometry, &bounding_geometry,
|
mtk_rectangle_intersect (set_geometry, &bounding_geometry,
|
||||||
&intersected_geometry);
|
&intersected_geometry);
|
||||||
|
|
||||||
*out_geometry = intersected_geometry;
|
*out_geometry = intersected_geometry;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user