diff options
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r-- | sway/commands/swap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c index 670d6bca..a8beb162 100644 --- a/sway/commands/swap.c +++ b/sway/commands/swap.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include "sway/tree/workspace.h" | 11 | #include "sway/tree/workspace.h" |
12 | #include "stringop.h" | 12 | #include "stringop.h" |
13 | 13 | ||
14 | static const char* EXPECTED_SYNTAX = | 14 | static const char expected_syntax[] = |
15 | "Expected 'swap container with id|con_id|mark <arg>'"; | 15 | "Expected 'swap container with id|con_id|mark <arg>'"; |
16 | 16 | ||
17 | static void swap_places(struct sway_container *con1, | 17 | static void swap_places(struct sway_container *con1, |
@@ -171,12 +171,12 @@ struct cmd_results *cmd_swap(int argc, char **argv) { | |||
171 | return error; | 171 | return error; |
172 | } | 172 | } |
173 | if (!root->outputs->length) { | 173 | if (!root->outputs->length) { |
174 | return cmd_results_new(CMD_INVALID, "swap", | 174 | return cmd_results_new(CMD_INVALID, |
175 | "Can't run this command while there's no outputs connected."); | 175 | "Can't run this command while there's no outputs connected."); |
176 | } | 176 | } |
177 | 177 | ||
178 | if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) { | 178 | if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) { |
179 | return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX); | 179 | return cmd_results_new(CMD_INVALID, expected_syntax); |
180 | } | 180 | } |
181 | 181 | ||
182 | struct sway_container *current = config->handler_context.container; | 182 | struct sway_container *current = config->handler_context.container; |
@@ -195,21 +195,21 @@ struct cmd_results *cmd_swap(int argc, char **argv) { | |||
195 | other = root_find_container(test_mark, value); | 195 | other = root_find_container(test_mark, value); |
196 | } else { | 196 | } else { |
197 | free(value); | 197 | free(value); |
198 | return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX); | 198 | return cmd_results_new(CMD_INVALID, expected_syntax); |
199 | } | 199 | } |
200 | 200 | ||
201 | if (!other) { | 201 | if (!other) { |
202 | error = cmd_results_new(CMD_FAILURE, "swap", | 202 | error = cmd_results_new(CMD_FAILURE, |
203 | "Failed to find %s '%s'", argv[2], value); | 203 | "Failed to find %s '%s'", argv[2], value); |
204 | } else if (!current) { | 204 | } else if (!current) { |
205 | error = cmd_results_new(CMD_FAILURE, "swap", | 205 | error = cmd_results_new(CMD_FAILURE, |
206 | "Can only swap with containers and views"); | 206 | "Can only swap with containers and views"); |
207 | } else if (container_has_ancestor(current, other) | 207 | } else if (container_has_ancestor(current, other) |
208 | || container_has_ancestor(other, current)) { | 208 | || container_has_ancestor(other, current)) { |
209 | error = cmd_results_new(CMD_FAILURE, "swap", | 209 | error = cmd_results_new(CMD_FAILURE, |
210 | "Cannot swap ancestor and descendant"); | 210 | "Cannot swap ancestor and descendant"); |
211 | } else if (container_is_floating(current) || container_is_floating(other)) { | 211 | } else if (container_is_floating(current) || container_is_floating(other)) { |
212 | error = cmd_results_new(CMD_FAILURE, "swap", | 212 | error = cmd_results_new(CMD_FAILURE, |
213 | "Swapping with floating containers is not supported"); | 213 | "Swapping with floating containers is not supported"); |
214 | } | 214 | } |
215 | 215 | ||
@@ -226,5 +226,5 @@ struct cmd_results *cmd_swap(int argc, char **argv) { | |||
226 | arrange_node(node_get_parent(&other->node)); | 226 | arrange_node(node_get_parent(&other->node)); |
227 | } | 227 | } |
228 | 228 | ||
229 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 229 | return cmd_results_new(CMD_SUCCESS, NULL); |
230 | } | 230 | } |