aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/resize.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index 4cefe60b..0c9af12d 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -160,7 +160,7 @@ void container_resize_tiled(struct sway_container *con,
160 } 160 }
161 161
162 // Apply new dimensions 162 // Apply new dimensions
163 int sibling_amount = prev ? amount / 2 : amount; 163 int sibling_amount = prev ? ceil((double)amount / 2.0) : amount;
164 164
165 if (is_horizontal(axis)) { 165 if (is_horizontal(axis)) {
166 if (con->width + amount < MIN_SANE_W) { 166 if (con->width + amount < MIN_SANE_W) {
@@ -173,13 +173,15 @@ void container_resize_tiled(struct sway_container *con,
173 return; 173 return;
174 } 174 }
175 175
176 con->width_fraction += 176 double amount_fraction =
177 ((double)amount / con->width) * con->width_fraction; 177 ((double)amount / con->width) * con->width_fraction;
178 next->width_fraction -= 178 double sibling_amount_fraction =
179 ((double)sibling_amount / con->width) * con->width_fraction; 179 prev ? amount_fraction / 2.0 : amount_fraction;
180
181 con->width_fraction += amount_fraction;
182 next->width_fraction -= sibling_amount_fraction;
180 if (prev) { 183 if (prev) {
181 prev->width_fraction -= 184 prev->width_fraction -= sibling_amount_fraction;
182 ((double)sibling_amount / con->width) * con->width_fraction;
183 } 185 }
184 } else { 186 } else {
185 if (con->height + amount < MIN_SANE_H) { 187 if (con->height + amount < MIN_SANE_H) {
@@ -192,13 +194,15 @@ void container_resize_tiled(struct sway_container *con,
192 return; 194 return;
193 } 195 }
194 196
195 con->height_fraction += 197 double amount_fraction =
196 ((double)amount / con->height) * con->height_fraction; 198 ((double)amount / con->height) * con->height_fraction;
197 next->height_fraction -= 199 double sibling_amount_fraction =
198 ((double)sibling_amount / con->height) * con->height_fraction; 200 prev ? amount_fraction / 2.0 : amount_fraction;
201
202 con->height_fraction += amount_fraction;
203 next->height_fraction -= sibling_amount_fraction;
199 if (prev) { 204 if (prev) {
200 prev->height_fraction -= 205 prev->height_fraction -= sibling_amount_fraction;
201 ((double)sibling_amount / con->height) * con->height_fraction;
202 } 206 }
203 } 207 }
204 208