diff options
-rw-r--r-- | include/sway/tree/node.h | 3 | ||||
-rw-r--r-- | sway/commands/resize.c | 2 | ||||
-rw-r--r-- | sway/tree/arrange.c | 10 |
3 files changed, 11 insertions, 4 deletions
diff --git a/include/sway/tree/node.h b/include/sway/tree/node.h index 5b8c1909..470ee3b5 100644 --- a/include/sway/tree/node.h +++ b/include/sway/tree/node.h | |||
@@ -3,6 +3,9 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include "list.h" | 4 | #include "list.h" |
5 | 5 | ||
6 | #define MIN_SANE_W 100 | ||
7 | #define MIN_SANE_H 60 | ||
8 | |||
6 | struct sway_root; | 9 | struct sway_root; |
7 | struct sway_output; | 10 | struct sway_output; |
8 | struct sway_workspace; | 11 | struct sway_workspace; |
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index 28f2552e..4cefe60b 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -15,8 +15,6 @@ | |||
15 | #define AXIS_HORIZONTAL (WLR_EDGE_LEFT | WLR_EDGE_RIGHT) | 15 | #define AXIS_HORIZONTAL (WLR_EDGE_LEFT | WLR_EDGE_RIGHT) |
16 | #define AXIS_VERTICAL (WLR_EDGE_TOP | WLR_EDGE_BOTTOM) | 16 | #define AXIS_VERTICAL (WLR_EDGE_TOP | WLR_EDGE_BOTTOM) |
17 | 17 | ||
18 | static const int MIN_SANE_W = 100, MIN_SANE_H = 60; | ||
19 | |||
20 | enum resize_unit { | 18 | enum resize_unit { |
21 | RESIZE_UNIT_PX, | 19 | RESIZE_UNIT_PX, |
22 | RESIZE_UNIT_PPT, | 20 | RESIZE_UNIT_PPT, |
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); |