summaryrefslogtreecommitdiffstats
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 914b6a9d..accdf6e3 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -700,28 +700,7 @@ void workspace_insert_tiling(struct sway_workspace *workspace,
700 node_set_dirty(&con->node); 700 node_set_dirty(&con->node);
701} 701}
702 702
703void workspace_remove_gaps(struct sway_workspace *ws) {
704 if (ws->current_gaps.top == 0 && ws->current_gaps.right == 0 &&
705 ws->current_gaps.bottom == 0 && ws->current_gaps.left == 0) {
706 return;
707 }
708
709 ws->width += ws->current_gaps.left + ws->current_gaps.right;
710 ws->height += ws->current_gaps.top + ws->current_gaps.bottom;
711 ws->x -= ws->current_gaps.left;
712 ws->y -= ws->current_gaps.top;
713
714 ws->current_gaps.top = 0;
715 ws->current_gaps.right = 0;
716 ws->current_gaps.bottom = 0;
717 ws->current_gaps.left = 0;
718}
719
720void workspace_add_gaps(struct sway_workspace *ws) { 703void workspace_add_gaps(struct sway_workspace *ws) {
721 if (ws->current_gaps.top > 0 || ws->current_gaps.right > 0 ||
722 ws->current_gaps.bottom > 0 || ws->current_gaps.left > 0) {
723 return;
724 }
725 if (config->smart_gaps) { 704 if (config->smart_gaps) {
726 struct sway_seat *seat = input_manager_get_default_seat(); 705 struct sway_seat *seat = input_manager_get_default_seat();
727 struct sway_container *focus = 706 struct sway_container *focus =
@@ -730,20 +709,19 @@ void workspace_add_gaps(struct sway_workspace *ws) {
730 focus = seat_get_focus_inactive_view(seat, &focus->node); 709 focus = seat_get_focus_inactive_view(seat, &focus->node);
731 } 710 }
732 if (focus && focus->view && view_is_only_visible(focus->view)) { 711 if (focus && focus->view && view_is_only_visible(focus->view)) {
712 ws->current_gaps.top = 0;
713 ws->current_gaps.right = 0;
714 ws->current_gaps.bottom = 0;
715 ws->current_gaps.left = 0;
733 return; 716 return;
734 } 717 }
735 } 718 }
736 719
737 ws->current_gaps = ws->gaps_outer; 720 ws->current_gaps = ws->gaps_outer;
738 if (ws->layout == L_TABBED || ws->layout == L_STACKED) { 721 ws->current_gaps.top += ws->gaps_inner;
739 // We have to add inner gaps for this, because children of tabbed and 722 ws->current_gaps.right += ws->gaps_inner;
740 // stacked containers don't apply their own gaps - they assume the 723 ws->current_gaps.bottom += ws->gaps_inner;
741 // tabbed/stacked container is using gaps. 724 ws->current_gaps.left += ws->gaps_inner;
742 ws->current_gaps.top += ws->gaps_inner;
743 ws->current_gaps.right += ws->gaps_inner;
744 ws->current_gaps.bottom += ws->gaps_inner;
745 ws->current_gaps.left += ws->gaps_inner;
746 }
747 725
748 ws->x += ws->current_gaps.left; 726 ws->x += ws->current_gaps.left;
749 ws->y += ws->current_gaps.top; 727 ws->y += ws->current_gaps.top;