diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-30 13:47:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-30 13:47:35 +0200 |
commit | f1dbdce0b2cfb6a71f972dd58180337c8ad27096 (patch) | |
tree | 061fc029a12ea5edd42444a1c03176083b210bf3 /sway/tree | |
parent | Merge pull request #2728 from RedSoxFan/move-sticky-on-evac (diff) | |
parent | Update gaps documentation (diff) | |
download | sway-f1dbdce0b2cfb6a71f972dd58180337c8ad27096.tar.gz sway-f1dbdce0b2cfb6a71f972dd58180337c8ad27096.tar.zst sway-f1dbdce0b2cfb6a71f972dd58180337c8ad27096.zip |
Merge pull request #2726 from RyanDwyer/overhaul-gaps
Make gaps implementation consistent with i3-gaps
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/container.c | 2 | ||||
-rw-r--r-- | sway/tree/workspace.c | 18 |
2 files changed, 17 insertions, 3 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index c30e7784..788300cc 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1029,7 +1029,7 @@ void container_add_gaps(struct sway_container *c) { | |||
1029 | 1029 | ||
1030 | struct sway_workspace *ws = c->workspace; | 1030 | struct sway_workspace *ws = c->workspace; |
1031 | 1031 | ||
1032 | c->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner; | 1032 | c->current_gaps = ws->gaps_inner; |
1033 | c->x += c->current_gaps; | 1033 | c->x += c->current_gaps; |
1034 | c->y += c->current_gaps; | 1034 | c->y += c->current_gaps; |
1035 | c->width -= 2 * c->current_gaps; | 1035 | c->width -= 2 * c->current_gaps; |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index d65a3e4c..9dd5c815 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -68,6 +68,20 @@ struct sway_workspace *workspace_create(struct sway_output *output, | |||
68 | ws->output_priority = create_list(); | 68 | ws->output_priority = create_list(); |
69 | workspace_output_add_priority(ws, output); | 69 | workspace_output_add_priority(ws, output); |
70 | 70 | ||
71 | ws->gaps_outer = config->gaps_outer; | ||
72 | ws->gaps_inner = config->gaps_inner; | ||
73 | if (name) { | ||
74 | struct workspace_config *wsc = workspace_find_config(name); | ||
75 | if (wsc) { | ||
76 | if (wsc->gaps_outer != -1) { | ||
77 | ws->gaps_outer = wsc->gaps_outer; | ||
78 | } | ||
79 | if (wsc->gaps_inner != -1) { | ||
80 | ws->gaps_inner = wsc->gaps_inner; | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | |||
71 | output_add_workspace(output, ws); | 85 | output_add_workspace(output, ws); |
72 | output_sort_workspaces(output); | 86 | output_sort_workspaces(output); |
73 | 87 | ||
@@ -632,13 +646,13 @@ void workspace_add_gaps(struct sway_workspace *ws) { | |||
632 | return; | 646 | return; |
633 | } | 647 | } |
634 | 648 | ||
635 | ws->current_gaps = ws->has_gaps ? ws->gaps_outer : config->gaps_outer; | 649 | ws->current_gaps = ws->gaps_outer; |
636 | 650 | ||
637 | if (ws->layout == L_TABBED || ws->layout == L_STACKED) { | 651 | if (ws->layout == L_TABBED || ws->layout == L_STACKED) { |
638 | // We have to add inner gaps for this, because children of tabbed and | 652 | // We have to add inner gaps for this, because children of tabbed and |
639 | // stacked containers don't apply their own gaps - they assume the | 653 | // stacked containers don't apply their own gaps - they assume the |
640 | // tabbed/stacked container is using gaps. | 654 | // tabbed/stacked container is using gaps. |
641 | ws->current_gaps += ws->has_gaps ? ws->gaps_inner : config->gaps_inner; | 655 | ws->current_gaps += ws->gaps_inner; |
642 | } | 656 | } |
643 | 657 | ||
644 | ws->x += ws->current_gaps; | 658 | ws->x += ws->current_gaps; |