aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-30 13:47:35 +0200
committerGitHub <noreply@github.com>2018-09-30 13:47:35 +0200
commitf1dbdce0b2cfb6a71f972dd58180337c8ad27096 (patch)
tree061fc029a12ea5edd42444a1c03176083b210bf3 /sway/tree
parente518c5dbaf93ab4f83031e83e03823d85469a30f (diff)
parent7661c71b3323f4bc6a8253b16cb12be8ef1a1d12 (diff)
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.c2
-rw-r--r--sway/tree/workspace.c18
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) {
struct sway_workspace *ws = c->workspace;
- c->current_gaps = ws->has_gaps ? ws->gaps_inner : config->gaps_inner;
+ c->current_gaps = ws->gaps_inner;
c->x += c->current_gaps;
c->y += c->current_gaps;
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,
ws->output_priority = create_list();
workspace_output_add_priority(ws, output);
+ ws->gaps_outer = config->gaps_outer;
+ ws->gaps_inner = config->gaps_inner;
+ if (name) {
+ struct workspace_config *wsc = workspace_find_config(name);
+ if (wsc) {
+ if (wsc->gaps_outer != -1) {
+ ws->gaps_outer = wsc->gaps_outer;
+ }
+ if (wsc->gaps_inner != -1) {
+ ws->gaps_inner = wsc->gaps_inner;
+ }
+ }
+ }
+
output_add_workspace(output, ws);
output_sort_workspaces(output);
@@ -632,13 +646,13 @@ void workspace_add_gaps(struct sway_workspace *ws) {
return;
}
- ws->current_gaps = ws->has_gaps ? ws->gaps_outer : config->gaps_outer;
+ ws->current_gaps = ws->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->current_gaps += ws->gaps_inner;
}
ws->x += ws->current_gaps;