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.
This commit is contained in:
Pedro Côrte-Real 2019-06-27 19:29:19 +01:00
parent 89ce6a80f1
commit 6fae29ee48

View file

@ -1182,9 +1182,13 @@ void container_remove_gaps(struct sway_container *c) {
} }
c->width += c->current_gaps.left + c->current_gaps.right; 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->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->x -= c->current_gaps.left;
c->saved_x -= c->current_gaps.left;
c->y -= c->current_gaps.top; c->y -= c->current_gaps.top;
c->saved_y -= c->current_gaps.top;
c->current_gaps.top = 0; c->current_gaps.top = 0;
c->current_gaps.right = 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->current_gaps.left = c->x == ws->x ? ws->gaps_inner : 0;
c->x += c->current_gaps.left; c->x += c->current_gaps.left;
c->saved_x += c->current_gaps.left;
c->y += c->current_gaps.top; c->y += c->current_gaps.top;
c->saved_y += c->current_gaps.top;
c->width -= c->current_gaps.left + c->current_gaps.right; 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->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) { enum sway_container_layout container_parent_layout(struct sway_container *con) {