aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-26 10:16:49 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-28 23:50:41 +1000
commitf5b9815128b6c000bb5d47c339480fa481a5e99d (patch)
tree24b533a7579dde0f65392afbba5f3982fe5e79c6 /sway/tree/container.c
parentMerge pull request #2523 from RedSoxFan/fix-floating-drag-outputs (diff)
downloadsway-f5b9815128b6c000bb5d47c339480fa481a5e99d.tar.gz
sway-f5b9815128b6c000bb5d47c339480fa481a5e99d.tar.zst
sway-f5b9815128b6c000bb5d47c339480fa481a5e99d.zip
Prepare arrange code for type safe arguments
This commit changes the arrange code in a way that will support type safe arguments. The arrange_output et al functions are now public, however I opted not to use them directly yet. I've kept the generic arrange_windows there for convenience until type safety is fully implemented. This means this patch has much less risk of breaking things as it would otherwise. To be type safe, arrange_children_of cannot exist in its previous form because the thing passed to it could be either a workspace or a container. So it's now renamed to arrange_children and accepts a list_t, as well as the parent layout and parent's box. There was some code which checked the grandparent's layout to see if it was tabbed or stacked and adjusted the Y offset of the grandchild accordingly. Accessing the grandparent layout isn't easy when using type safe arguments, and it seemed odd to even need to do this. I determined that this was needed because a child of a tabbed container would have a swayc Y matching the top of the tab bar. I've changed this so a child of a tabbed container will have a swayc Y matching the bottom of the tab bar, which means we don't need to access the grandparent layout. Some tweaks to the rendering and autoconfigure code have been made to implement this, and the container_at code appears to work without needing any changes. arrange_children_of (now arrange_children) would check if the parent had gaps and would copy them to the child, effectively making the workspace's gaps recurse into all children. We can't do this any more without passing has_gaps, gaps_inner and gaps_outer as arguments to arrange_children, so I've changed the add_gaps function to retrieve it from the workspace directly. apply_tabbed_or_stacked_layout has been split into two functions, as it had different logic depending on the layout. Lastly, arrange.h had an unnecessary include of transaction.h. I've removed it, which means I've had to add it to several other files.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 04454ab6..1b193944 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1163,7 +1163,9 @@ void container_add_gaps(struct sway_container *c) {
1163 return; 1163 return;
1164 } 1164 }
1165 1165
1166 c->current_gaps = c->has_gaps ? c->gaps_inner : config->gaps_inner; 1166 struct sway_container *ws = container_parent(c, C_WORKSPACE);
1167
1168 c->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
1167 c->x += c->current_gaps; 1169 c->x += c->current_gaps;
1168 c->y += c->current_gaps; 1170 c->y += c->current_gaps;
1169 c->width -= 2 * c->current_gaps; 1171 c->width -= 2 * c->current_gaps;