aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-01-14 11:44:18 -0500
committerGitHub <noreply@github.com>2019-01-14 11:44:18 -0500
commit15cd8b6a86295a445a1037afd0028b1226a14c82 (patch)
tree56332b9c150459beb5aef94605372ef179ec8854 /sway/commands/swap.c
parent64ef9366733d6d332a24897f72eba90ba2adca1e (diff)
parent2a684cad5fc8e12a8e47a7fd00e2b7c66b43afb0 (diff)
Merge pull request #3403 from mstoeckl/ipcleanup
Remove 'input' field of IPC command return json
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c18
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 @@
#include "sway/tree/workspace.h"
#include "stringop.h"
-static const char* EXPECTED_SYNTAX =
+static const char expected_syntax[] =
"Expected 'swap container with id|con_id|mark <arg>'";
static void swap_places(struct sway_container *con1,
@@ -171,12 +171,12 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
return error;
}
if (!root->outputs->length) {
- return cmd_results_new(CMD_INVALID, "swap",
+ return cmd_results_new(CMD_INVALID,
"Can't run this command while there's no outputs connected.");
}
if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) {
- return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX);
+ return cmd_results_new(CMD_INVALID, expected_syntax);
}
struct sway_container *current = config->handler_context.container;
@@ -195,21 +195,21 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
other = root_find_container(test_mark, value);
} else {
free(value);
- return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX);
+ return cmd_results_new(CMD_INVALID, expected_syntax);
}
if (!other) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Failed to find %s '%s'", argv[2], value);
} else if (!current) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Can only swap with containers and views");
} else if (container_has_ancestor(current, other)
|| container_has_ancestor(other, current)) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Cannot swap ancestor and descendant");
} else if (container_is_floating(current) || container_is_floating(other)) {
- error = cmd_results_new(CMD_FAILURE, "swap",
+ error = cmd_results_new(CMD_FAILURE,
"Swapping with floating containers is not supported");
}
@@ -226,5 +226,5 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
arrange_node(node_get_parent(&other->node));
}
- return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+ return cmd_results_new(CMD_SUCCESS, NULL);
}