From ce54b4ff2eeda61ead9389a9bfd41aa7310a6ece Mon Sep 17 00:00:00 2001 From: "S. Christoffer Eliesen" Date: Sat, 19 Dec 2015 01:21:00 +0100 Subject: [PATCH 1/2] container: Fix inner gaps against screen edge. --- sway/container.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sway/container.c b/sway/container.c index b85d21144..e6fa4f376 100644 --- a/sway/container.c +++ b/sway/container.c @@ -671,7 +671,16 @@ int swayc_gap(swayc_t *container) { if (container->type == C_VIEW) { return container->gaps >= 0 ? container->gaps : config->gaps_inner; } else if (container->type == C_WORKSPACE) { - return container->gaps >= 0 ? container->gaps : config->gaps_outer; + int base = container->gaps >= 0 ? container->gaps : config->gaps_outer; + if (config->edge_gaps) { + // the inner gap is created via a margin around each window which + // is half the gap size, so the workspace also needs half a gap + // size to make the outermost gap the same size (excluding the + // actual "outer gap" size which is handled independently) + return base + config->gaps_inner / 2; + } else { + return base; + } } else { return 0; } From f4b9c3856a03ce51d8761c32da8bd0986680b534 Mon Sep 17 00:00:00 2001 From: "S. Christoffer Eliesen" Date: Sun, 20 Dec 2015 21:21:08 +0100 Subject: [PATCH 2/2] layout: Fix `edge_gaps off` with top/left panels. Since x/y won't be zero when there's a top or left panel in place, we need to take those coordinates into account too. --- sway/layout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/layout.c b/sway/layout.c index 6d82921c2..a9e7c7f1f 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -398,10 +398,10 @@ void update_geometry(swayc_t *container) { geometry.size.h = container->height - gap/2; } if (container->x + container->width + gap >= ws->x + ws->width) { - geometry.size.w = ws->width - geometry.origin.x; + geometry.size.w = ws->x + ws->width - geometry.origin.x; } if (container->y + container->height + gap >= ws->y + ws->height) { - geometry.size.h = ws->height - geometry.origin.y; + geometry.size.h = ws->y + ws->height - geometry.origin.y; } } wlc_view_set_geometry(container->handle, 0, &geometry);