aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-08-06 04:46:57 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-08-14 13:18:57 +0900
commit75a7b02529bc1e3d77b46200ab1d2028929fb5fe (patch)
tree890657f25edfd59fb41821f5efa94df5120bda20 /sway/tree/container.c
parentswaymsg.1: add tip about two hyphens for commands (diff)
downloadsway-75a7b02529bc1e3d77b46200ab1d2028929fb5fe.tar.gz
sway-75a7b02529bc1e3d77b46200ab1d2028929fb5fe.tar.zst
sway-75a7b02529bc1e3d77b46200ab1d2028929fb5fe.zip
container_replace: copy {width,height}_fraction
This copies the width and height fractions from the container to the container replacing it. Without setting these values, the container is treated as a new container and throws off the existing sizing. Since one container is replacing the other, it makes sense for the sizing to remain the same.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index ef44c944..7068e166 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1324,8 +1324,12 @@ void container_replace(struct sway_container *container,
1324 root_scratchpad_remove_container(container); 1324 root_scratchpad_remove_container(container);
1325 } 1325 }
1326 if (container->parent || container->workspace) { 1326 if (container->parent || container->workspace) {
1327 float width_fraction = container->width_fraction;
1328 float height_fraction = container->height_fraction;
1327 container_add_sibling(container, replacement, 1); 1329 container_add_sibling(container, replacement, 1);
1328 container_detach(container); 1330 container_detach(container);
1331 replacement->width_fraction = width_fraction;
1332 replacement->height_fraction = height_fraction;
1329 } 1333 }
1330 if (scratchpad) { 1334 if (scratchpad) {
1331 root_scratchpad_add_container(replacement, ws); 1335 root_scratchpad_add_container(replacement, ws);