mirror of
https://github.com/swaywm/sway.git
synced 2024-11-16 05:03:17 +00:00
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
This commit is contained in:
parent
fc16fb6549
commit
6c234d013a
|
@ -253,12 +253,27 @@ static struct cmd_results *resize_adjust_tiled(uint32_t axis,
|
||||||
amount->unit = MOVEMENT_UNIT_PPT;
|
amount->unit = MOVEMENT_UNIT_PPT;
|
||||||
}
|
}
|
||||||
if (amount->unit == MOVEMENT_UNIT_PPT) {
|
if (amount->unit == MOVEMENT_UNIT_PPT) {
|
||||||
|
struct sway_container *parent = current->pending.parent;
|
||||||
float pct = amount->amount / 100.0f;
|
float pct = amount->amount / 100.0f;
|
||||||
|
|
||||||
if (is_horizontal(axis)) {
|
if (is_horizontal(axis)) {
|
||||||
amount->amount = (float)current->pending.width * pct;
|
while (parent && parent->pending.layout != L_HORIZ) {
|
||||||
|
parent = parent->pending.parent;
|
||||||
|
}
|
||||||
|
if (parent) {
|
||||||
|
amount->amount = (float)parent->pending.width * pct;
|
||||||
} else {
|
} else {
|
||||||
amount->amount = (float)current->pending.height * pct;
|
amount->amount = (float)current->pending.workspace->width * pct;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (parent && parent->pending.layout != L_VERT) {
|
||||||
|
parent = parent->pending.parent;
|
||||||
|
}
|
||||||
|
if (parent) {
|
||||||
|
amount->amount = (float)parent->pending.height * pct;
|
||||||
|
} else {
|
||||||
|
amount->amount = (float)current->pending.workspace->height * pct;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue