aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
authorLibravatar Pedro CĂ´rte-Real <pedro@pedrocr.net>2019-06-28 22:21:20 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-07-14 11:13:55 -0400
commite3a3917d3afb66fc8ba3eebb7aed603d3b7ce844 (patch)
tree6af979d7b1c1aeed9d88f168a9a0d1e1f7e663c0 /sway/commands/swap.c
parentLayout correctly with several new windows (diff)
downloadsway-e3a3917d3afb66fc8ba3eebb7aed603d3b7ce844.tar.gz
sway-e3a3917d3afb66fc8ba3eebb7aed603d3b7ce844.tar.zst
sway-e3a3917d3afb66fc8ba3eebb7aed603d3b7ce844.zip
Layout tiled using a width/height fraction
Instead of using container->width/height as both the input and output of the layout calculation have container->width_fraction/height_fraction as the share of the parent this container occupies and calculate the layout based on that. That way the container arrangement can always be recalculated even if width/height have been altered by things like fullscreen. To do this several parts are reworked: - The vertical and horizontal arrangement code is ajusted to work with fractions instead of directly with width/height - The resize code is then changed to manipulate the fractions when working on tiled containers. - Finally the places that manipulated width/height are adjusted to match. The adjusted parts are container split, swap, and the input seat code. It's possible that some parts of the code are now adjusting width and height only for those to be immediately recalculated. That's harmless and since non-tiled containers are still sized with width/height directly it may avoid breaking other corner cases. Fixes #3547 Fixes #4297
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index f27aa7ed..a4a4108d 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -20,6 +20,8 @@ static void swap_places(struct sway_container *con1,
20 temp->y = con1->y; 20 temp->y = con1->y;
21 temp->width = con1->width; 21 temp->width = con1->width;
22 temp->height = con1->height; 22 temp->height = con1->height;
23 temp->width_fraction = con1->width_fraction;
24 temp->height_fraction = con1->height_fraction;
23 temp->parent = con1->parent; 25 temp->parent = con1->parent;
24 temp->workspace = con1->workspace; 26 temp->workspace = con1->workspace;
25 27
@@ -27,11 +29,15 @@ static void swap_places(struct sway_container *con1,
27 con1->y = con2->y; 29 con1->y = con2->y;
28 con1->width = con2->width; 30 con1->width = con2->width;
29 con1->height = con2->height; 31 con1->height = con2->height;
32 con1->width_fraction = con2->width_fraction;
33 con1->height_fraction = con2->height_fraction;
30 34
31 con2->x = temp->x; 35 con2->x = temp->x;
32 con2->y = temp->y; 36 con2->y = temp->y;
33 con2->width = temp->width; 37 con2->width = temp->width;
34 con2->height = temp->height; 38 con2->height = temp->height;
39 con2->width_fraction = temp->width_fraction;
40 con2->height_fraction = temp->height_fraction;
35 41
36 int temp_index = container_sibling_index(con1); 42 int temp_index = container_sibling_index(con1);
37 if (con2->parent) { 43 if (con2->parent) {