From 6fae29ee483271ba4765ab16cfd7739a57ee44b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20C=C3=B4rte-Real?= Date: Thu, 27 Jun 2019 19:29:19 +0100 Subject: [PATCH] Also relayout correctly with gaps When doing the layout of a container that includes a fullscreen child also layout new windows correctly if gaps are being used. This is done by also adjusting the saved versions x/y/width/height by the gaps so that the layout adjustments take them into account. --- sway/tree/container.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sway/tree/container.c b/sway/tree/container.c index 591bf9b1a..e1b55bd8b 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1182,9 +1182,13 @@ void container_remove_gaps(struct sway_container *c) { } c->width += c->current_gaps.left + c->current_gaps.right; + c->saved_width += c->current_gaps.left + c->current_gaps.right; c->height += c->current_gaps.top + c->current_gaps.bottom; + c->saved_height += c->current_gaps.top + c->current_gaps.bottom; c->x -= c->current_gaps.left; + c->saved_x -= c->current_gaps.left; c->y -= c->current_gaps.top; + c->saved_y -= c->current_gaps.top; c->current_gaps.top = 0; c->current_gaps.right = 0; @@ -1236,9 +1240,13 @@ void container_add_gaps(struct sway_container *c) { c->current_gaps.left = c->x == ws->x ? ws->gaps_inner : 0; c->x += c->current_gaps.left; + c->saved_x += c->current_gaps.left; c->y += c->current_gaps.top; + c->saved_y += c->current_gaps.top; c->width -= c->current_gaps.left + c->current_gaps.right; + c->saved_width -= c->current_gaps.left + c->current_gaps.right; c->height -= c->current_gaps.top + c->current_gaps.bottom; + c->saved_height -= c->current_gaps.top + c->current_gaps.bottom; } enum sway_container_layout container_parent_layout(struct sway_container *con) {