diff options
Diffstat (limited to 'sway/tree/arrange.c')
-rw-r--r-- | sway/tree/arrange.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index caafb1af..696d0e1f 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c | |||
@@ -68,7 +68,10 @@ static void apply_horiz_layout(list_t *children, struct wlr_box *parent) { | |||
68 | } | 68 | } |
69 | temp = temp->parent; | 69 | temp = temp->parent; |
70 | } | 70 | } |
71 | double child_total_width = parent->width - inner_gap * (children->length - 1); | 71 | double total_gap = fmin(inner_gap * (children->length - 1), |
72 | fmax(0, parent->width - MIN_SANE_W * children->length)); | ||
73 | double child_total_width = parent->width - total_gap; | ||
74 | inner_gap = total_gap / (children->length - 1); | ||
72 | 75 | ||
73 | // Resize windows | 76 | // Resize windows |
74 | sway_log(SWAY_DEBUG, "Arranging %p horizontally", parent); | 77 | sway_log(SWAY_DEBUG, "Arranging %p horizontally", parent); |
@@ -143,7 +146,10 @@ static void apply_vert_layout(list_t *children, struct wlr_box *parent) { | |||
143 | } | 146 | } |
144 | temp = temp->parent; | 147 | temp = temp->parent; |
145 | } | 148 | } |
146 | double child_total_height = parent->height - inner_gap * (children->length - 1); | 149 | double total_gap = fmin(inner_gap * (children->length - 1), |
150 | fmax(0, parent->height - MIN_SANE_H * children->length)); | ||
151 | double child_total_height = parent->height - total_gap; | ||
152 | inner_gap = total_gap / (children->length - 1); | ||
147 | 153 | ||
148 | // Resize windows | 154 | // Resize windows |
149 | sway_log(SWAY_DEBUG, "Arranging %p vertically", parent); | 155 | sway_log(SWAY_DEBUG, "Arranging %p vertically", parent); |