mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
SnapToRegion: Respect core.gap setting
This commit is contained in:
parent
eb5c8cfdad
commit
550e40b56b
1 changed files with 32 additions and 0 deletions
32
src/view.c
32
src/view.c
|
|
@ -375,6 +375,38 @@ view_apply_region_geometry(struct view *view)
|
|||
/* Create a copy of the original region geometry */
|
||||
struct wlr_box geo = view->tiled_region->geo;
|
||||
|
||||
/* Adjust for rc.gap */
|
||||
struct output *output = view_output(view);
|
||||
if (rc.gap && output) {
|
||||
double half_gap = rc.gap / 2.0;
|
||||
struct wlr_fbox offset = {
|
||||
.x = half_gap,
|
||||
.y = half_gap,
|
||||
.width = -rc.gap,
|
||||
.height = -rc.gap
|
||||
};
|
||||
struct wlr_box usable =
|
||||
output_usable_area_in_layout_coords(output);
|
||||
if (geo.x == usable.x) {
|
||||
offset.x += half_gap;
|
||||
offset.width -= half_gap;
|
||||
}
|
||||
if (geo.y == usable.y) {
|
||||
offset.y += half_gap;
|
||||
offset.height -= half_gap;
|
||||
}
|
||||
if (geo.x + geo.width == usable.x + usable.width) {
|
||||
offset.width -= half_gap;
|
||||
}
|
||||
if (geo.y + geo.height == usable.y + usable.height) {
|
||||
offset.height -= half_gap;
|
||||
}
|
||||
geo.x += offset.x;
|
||||
geo.y += offset.y;
|
||||
geo.width += offset.width;
|
||||
geo.height += offset.height;
|
||||
}
|
||||
|
||||
/* And adjust for current view */
|
||||
struct border margin = ssd_get_margin(view->ssd);
|
||||
geo.x += margin.left;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue