diff options
Diffstat (limited to 'sway/commands/gaps.c')
-rw-r--r-- | sway/commands/gaps.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c index 3906eb70..d676e475 100644 --- a/sway/commands/gaps.c +++ b/sway/commands/gaps.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "sway/commands.h" | 2 | #include "sway/commands.h" |
3 | #include "sway/config.h" | 3 | #include "sway/config.h" |
4 | #include "sway/tree/arrange.h" | 4 | #include "sway/tree/arrange.h" |
5 | #include "sway/tree/workspace.h" | ||
5 | #include "log.h" | 6 | #include "log.h" |
6 | #include "stringop.h" | 7 | #include "stringop.h" |
7 | #include <math.h> | 8 | #include <math.h> |
@@ -43,7 +44,7 @@ struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
43 | return cmd_results_new(CMD_INVALID, "gaps", | 44 | return cmd_results_new(CMD_INVALID, "gaps", |
44 | "gaps edge_gaps on|off|toggle"); | 45 | "gaps edge_gaps on|off|toggle"); |
45 | } | 46 | } |
46 | arrange_windows(&root_container); | 47 | arrange_root(); |
47 | } else { | 48 | } else { |
48 | int amount_idx = 0; // the current index in argv | 49 | int amount_idx = 0; // the current index in argv |
49 | enum gaps_op op = GAPS_OP_SET; | 50 | enum gaps_op op = GAPS_OP_SET; |
@@ -124,7 +125,7 @@ struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
124 | if (amount_idx == 0) { // gaps <amount> | 125 | if (amount_idx == 0) { // gaps <amount> |
125 | config->gaps_inner = val; | 126 | config->gaps_inner = val; |
126 | config->gaps_outer = val; | 127 | config->gaps_outer = val; |
127 | arrange_windows(&root_container); | 128 | arrange_root(); |
128 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 129 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
129 | } | 130 | } |
130 | // Other variants. The middle-length variant (gaps inner|outer <amount>) | 131 | // Other variants. The middle-length variant (gaps inner|outer <amount>) |
@@ -155,21 +156,27 @@ struct cmd_results *cmd_gaps(int argc, char **argv) { | |||
155 | } else { | 156 | } else { |
156 | config->gaps_outer = total; | 157 | config->gaps_outer = total; |
157 | } | 158 | } |
158 | arrange_windows(&root_container); | 159 | arrange_root(); |
159 | } else { | 160 | } else { |
160 | struct sway_container *c = | 161 | if (scope == GAPS_SCOPE_WORKSPACE) { |
161 | config->handler_context.current_container; | 162 | struct sway_workspace *ws = config->handler_context.workspace; |
162 | if (scope == GAPS_SCOPE_WORKSPACE && c->type != C_WORKSPACE) { | 163 | ws->has_gaps = true; |
163 | c = container_parent(c, C_WORKSPACE); | 164 | if (inner) { |
164 | } | 165 | ws->gaps_inner = total; |
165 | c->has_gaps = true; | 166 | } else { |
166 | if (inner) { | 167 | ws->gaps_outer = total; |
167 | c->gaps_inner = total; | 168 | } |
169 | arrange_workspace(ws); | ||
168 | } else { | 170 | } else { |
169 | c->gaps_outer = total; | 171 | struct sway_container *c = config->handler_context.container; |
172 | c->has_gaps = true; | ||
173 | if (inner) { | ||
174 | c->gaps_inner = total; | ||
175 | } else { | ||
176 | c->gaps_outer = total; | ||
177 | } | ||
178 | arrange_workspace(c->workspace); | ||
170 | } | 179 | } |
171 | |||
172 | arrange_windows(c->parent ? c->parent : &root_container); | ||
173 | } | 180 | } |
174 | } | 181 | } |
175 | 182 | ||