From 7262bf655f7a19af1d4c8681be74d70bfc6b8911 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sat, 24 Feb 2018 13:22:57 -0500 Subject: remove checks for command handlers --- sway/commands/exit.c | 3 --- sway/commands/focus.c | 14 -------------- sway/commands/kill.c | 8 -------- sway/commands/layout.c | 9 --------- sway/commands/reload.c | 3 --- 5 files changed, 37 deletions(-) (limited to 'sway') diff --git a/sway/commands/exit.c b/sway/commands/exit.c index 4bb6a97b..d5353c20 100644 --- a/sway/commands/exit.c +++ b/sway/commands/exit.c @@ -6,9 +6,6 @@ void sway_terminate(int exit_code); struct cmd_results *cmd_exit(int argc, char **argv) { struct cmd_results *error = NULL; - if (config->reading) { - return cmd_results_new(CMD_FAILURE, "exit", "Can't be used in config file."); - } if ((error = checkarg(argc, "exit", EXPECTED_EQUAL_TO, 0))) { return error; } diff --git a/sway/commands/focus.c b/sway/commands/focus.c index ba47d1e1..f1a8078f 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -33,20 +33,6 @@ static bool parse_movement_direction(const char *name, enum movement_direction * struct cmd_results *cmd_focus(int argc, char **argv) { swayc_t *con = config->handler_context.current_container; struct sway_seat *seat = config->handler_context.seat; - - if (!sway_assert(seat, "'focus' command called without seat context")) { - return cmd_results_new(CMD_FAILURE, "focus", - "Command 'focus' called without seat context (this is a bug in sway)"); - } - - if (config->reading) { - return cmd_results_new(CMD_FAILURE, "focus", - "Command 'focus' cannot be used in the config file"); - } - if (con == NULL) { - wlr_log(L_DEBUG, "no container to focus"); - return cmd_results_new(CMD_SUCCESS, NULL, NULL); - } if (con->type < C_WORKSPACE) { return cmd_results_new(CMD_FAILURE, "focus", "Command 'focus' cannot be used above the workspace level"); diff --git a/sway/commands/kill.c b/sway/commands/kill.c index 4b3666be..f408ce2a 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c @@ -6,14 +6,6 @@ #include "sway/commands.h" struct cmd_results *cmd_kill(int argc, char **argv) { - if (config->reading) { - return cmd_results_new(CMD_FAILURE, "kill", - "Command 'kill' cannot be used in the config file"); - } - if (config->handler_context.current_container == NULL) { - wlr_log(L_DEBUG, "no container to kill"); - return cmd_results_new(CMD_SUCCESS, NULL, NULL); - } enum swayc_types type = config->handler_context.current_container->type; if (type != C_VIEW && type != C_CONTAINER) { return cmd_results_new(CMD_INVALID, NULL, diff --git a/sway/commands/layout.c b/sway/commands/layout.c index d953abc8..b0fc5d66 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c @@ -7,19 +7,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) { struct cmd_results *error = NULL; - if (config->reading) { - return cmd_results_new(CMD_FAILURE, "layout", "Can't be used in config file."); - } - if (!config->active) { - return cmd_results_new(CMD_FAILURE, "layout", "Can only be used when sway is running."); - } if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { return error; } swayc_t *parent = config->handler_context.current_container; - if (!sway_assert(parent != NULL, "command called without container context")) { - return NULL; - } // TODO: floating /* diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 419c7de3..d54d40db 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -4,9 +4,6 @@ struct cmd_results *cmd_reload(int argc, char **argv) { struct cmd_results *error = NULL; - if (config->reading) { - return cmd_results_new(CMD_FAILURE, "reload", "Can't be used in config file."); - } if ((error = checkarg(argc, "reload", EXPECTED_EQUAL_TO, 0))) { return error; } -- cgit v1.2.3-54-g00ecf