aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
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) {
1159 "Expected a container or view")) { 1159 "Expected a container or view")) {
1160 return; 1160 return;
1161 } 1161 }
1162 if (c->current_gaps > 0 || c->type != C_VIEW) { 1162 if (c->current_gaps > 0) {
1163 return;
1164 }
1165 // Linear containers don't have gaps because it'd create double gaps
1166 if (c->type == C_CONTAINER &&
1167 c->layout != L_TABBED && c->layout != L_STACKED) {
1168 return;
1169 }
1170 // Children of tabbed/stacked containers re-use the gaps of the container
1171 enum sway_container_layout layout = c->parent->layout;
1172 if (layout == L_TABBED || layout == L_STACKED) {
1163 return; 1173 return;
1164 } 1174 }
1165 1175
@@ -1355,20 +1365,16 @@ struct sway_container *container_split(struct sway_container *child,
1355 1365
1356 wlr_log(WLR_DEBUG, "creating container %p around %p", cont, child); 1366 wlr_log(WLR_DEBUG, "creating container %p around %p", cont, child);
1357 1367
1358 child->type == C_WORKSPACE ? workspace_remove_gaps(child)
1359 : container_remove_gaps(child);
1360
1361 cont->prev_split_layout = L_NONE; 1368 cont->prev_split_layout = L_NONE;
1362 cont->width = child->width; 1369 cont->width = child->width;
1363 cont->height = child->height; 1370 cont->height = child->height;
1364 cont->x = child->x; 1371 cont->x = child->x;
1365 cont->y = child->y; 1372 cont->y = child->y;
1373 cont->current_gaps = child->current_gaps;
1366 1374
1367 struct sway_seat *seat = input_manager_get_default_seat(input_manager); 1375 struct sway_seat *seat = input_manager_get_default_seat(input_manager);
1368 bool set_focus = (seat_get_focus(seat) == child); 1376 bool set_focus = (seat_get_focus(seat) == child);
1369 1377
1370 container_add_gaps(cont);
1371
1372 if (child->type == C_WORKSPACE) { 1378 if (child->type == C_WORKSPACE) {
1373 struct sway_container *workspace = child; 1379 struct sway_container *workspace = child;
1374 while (workspace->children->length) { 1380 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) {
694 return; 694 return;
695 } 695 }
696 696
697 ws->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner; 697 ws->current_gaps = ws->has_gaps ? ws->gaps_outer : config->gaps_outer;
698
699 if (ws->layout == L_TABBED || ws->layout == L_STACKED) {
700 // We have to add inner gaps for this, because children of tabbed and
701 // stacked containers don't apply their own gaps - they assume the
702 // tabbed/stacked container is using gaps.
703 ws->current_gaps += ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
704 }
705
698 ws->x += ws->current_gaps; 706 ws->x += ws->current_gaps;
699 ws->y += ws->current_gaps; 707 ws->y += ws->current_gaps;
700 ws->width -= 2 * ws->current_gaps; 708 ws->width -= 2 * ws->current_gaps;