diff options
author | nukoseer <uygarkoseer@gmail.com> | 2023-06-05 19:34:24 +0000 |
---|---|---|
committer | Ronan Pigott <ronan@rjp.ie> | 2023-07-13 13:27:46 -0700 |
commit | 6c234d013a7457cefd7938182088530d631b875e (patch) | |
tree | a04e6e287403b71b728a5312296fbe593be02356 | |
parent | Send wl_surface.preferred_buffer_scale (diff) | |
download | sway-6c234d013a7457cefd7938182088530d631b875e.tar.gz sway-6c234d013a7457cefd7938182088530d631b875e.tar.zst sway-6c234d013a7457cefd7938182088530d631b875e.zip |
Calculate tiled resize amount relative to parent container
sway should shrinks/grows tiled windows according to parent container
for ppt unit for i3 compatibility.
Resolves: #7593
-rw-r--r-- | sway/commands/resize.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index e69e5506..f59e2aeb 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -253,12 +253,27 @@ static struct cmd_results *resize_adjust_tiled(uint32_t axis, | |||
253 | amount->unit = MOVEMENT_UNIT_PPT; | 253 | amount->unit = MOVEMENT_UNIT_PPT; |
254 | } | 254 | } |
255 | if (amount->unit == MOVEMENT_UNIT_PPT) { | 255 | if (amount->unit == MOVEMENT_UNIT_PPT) { |
256 | struct sway_container *parent = current->pending.parent; | ||
256 | float pct = amount->amount / 100.0f; | 257 | float pct = amount->amount / 100.0f; |
257 | 258 | ||
258 | if (is_horizontal(axis)) { | 259 | if (is_horizontal(axis)) { |
259 | amount->amount = (float)current->pending.width * pct; | 260 | while (parent && parent->pending.layout != L_HORIZ) { |
261 | parent = parent->pending.parent; | ||
262 | } | ||
263 | if (parent) { | ||
264 | amount->amount = (float)parent->pending.width * pct; | ||
265 | } else { | ||
266 | amount->amount = (float)current->pending.workspace->width * pct; | ||
267 | } | ||
260 | } else { | 268 | } else { |
261 | amount->amount = (float)current->pending.height * pct; | 269 | while (parent && parent->pending.layout != L_VERT) { |
270 | parent = parent->pending.parent; | ||
271 | } | ||
272 | if (parent) { | ||
273 | amount->amount = (float)parent->pending.height * pct; | ||
274 | } else { | ||
275 | amount->amount = (float)current->pending.workspace->height * pct; | ||
276 | } | ||
262 | } | 277 | } |
263 | } | 278 | } |
264 | 279 | ||