aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-28 23:53:51 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-08-28 23:53:51 +1000
commit126a82f14ff47925c7f88523ed9abe0ae9aeb7e8 (patch)
tree7cdac6c37f6ad87c056690bdeac3d5ea0489668d /sway/tree
parentf5b9815128b6c000bb5d47c339480fa481a5e99d (diff)
downloadsway-126a82f14ff47925c7f88523ed9abe0ae9aeb7e8.tar.xz
Fix gaps issues
* In layout command, arrange parent of parent - not sure why this is needed but it is * Remove gap adjustment when rendering * Workspace should use outer gaps, not inner * Add exceptions for tabbed and stacked containers * Don't mess with gap state when splitting a container
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c18
-rw-r--r--sway/tree/workspace.c10
2 files changed, 21 insertions, 7 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 1b193944..ee019098 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1159,7 +1159,17 @@ void container_add_gaps(struct sway_container *c) {
"Expected a container or view")) {
return;
}
- if (c->current_gaps > 0 || c->type != C_VIEW) {
+ if (c->current_gaps > 0) {
+ return;
+ }
+ // Linear containers don't have gaps because it'd create double gaps
+ if (c->type == C_CONTAINER &&
+ c->layout != L_TABBED && c->layout != L_STACKED) {
+ return;
+ }
+ // Children of tabbed/stacked containers re-use the gaps of the container
+ enum sway_container_layout layout = c->parent->layout;
+ if (layout == L_TABBED || layout == L_STACKED) {
return;
}
@@ -1355,20 +1365,16 @@ struct sway_container *container_split(struct sway_container *child,
wlr_log(WLR_DEBUG, "creating container %p around %p", cont, child);
- child->type == C_WORKSPACE ? workspace_remove_gaps(child)
- : container_remove_gaps(child);
-
cont->prev_split_layout = L_NONE;
cont->width = child->width;
cont->height = child->height;
cont->x = child->x;
cont->y = child->y;
+ cont->current_gaps = child->current_gaps;
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
bool set_focus = (seat_get_focus(seat) == child);
- container_add_gaps(cont);
-
if (child->type == C_WORKSPACE) {
struct sway_container *workspace = child;
while (workspace->children->length) {
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index d930826e..60256336 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -694,7 +694,15 @@ void workspace_add_gaps(struct sway_container *ws) {
return;
}
- ws->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
+ ws->current_gaps = ws->has_gaps ? ws->gaps_outer : config->gaps_outer;
+
+ if (ws->layout == L_TABBED || ws->layout == L_STACKED) {
+ // We have to add inner gaps for this, because children of tabbed and
+ // stacked containers don't apply their own gaps - they assume the
+ // tabbed/stacked container is using gaps.
+ ws->current_gaps += ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
+ }
+
ws->x += ws->current_gaps;
ws->y += ws->current_gaps;
ws->width -= 2 * ws->current_gaps;