overlay: take into account <core><gap> for edge overlay

This also deduplicates get_edge_snap_box() in interactive.c and
view_get_edge_snap_box() in view.c.
This commit is contained in:
tokyo4j 2025-07-05 16:06:38 +09:00 committed by Johan Malm
parent ca8d98e80f
commit 38e57891b5
5 changed files with 23 additions and 35 deletions

View file

@ -440,7 +440,7 @@ view_edge_invert(enum view_edge edge)
}
}
static struct wlr_box
struct wlr_box
view_get_edge_snap_box(struct view *view, struct output *output,
enum view_edge edge)
{
@ -469,14 +469,21 @@ view_get_edge_snap_box(struct view *view, struct output *output,
break;
}
struct border margin = ssd_get_margin(view->ssd);
struct wlr_box dst = {
.x = x_offset + usable.x + margin.left,
.y = y_offset + usable.y + margin.top,
.width = base_width - margin.left - margin.right,
.height = base_height - margin.top - margin.bottom,
.x = x_offset + usable.x,
.y = y_offset + usable.y,
.width = base_width,
.height = base_height,
};
if (view) {
struct border margin = ssd_get_margin(view->ssd);
dst.x += margin.left;
dst.y += margin.top;
dst.width -= margin.left + margin.right;
dst.height -= margin.top + margin.bottom;
}
return dst;
}