remove checks for command handlers

This commit is contained in:
Tony Crisci 2018-02-24 13:22:57 -05:00
parent 5b219a1598
commit 7262bf655f
5 changed files with 0 additions and 37 deletions

View file

@ -6,9 +6,6 @@ void sway_terminate(int exit_code);
struct cmd_results *cmd_exit(int argc, char **argv) { struct cmd_results *cmd_exit(int argc, char **argv) {
struct cmd_results *error = NULL; 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))) { if ((error = checkarg(argc, "exit", EXPECTED_EQUAL_TO, 0))) {
return error; return error;
} }

View file

@ -33,20 +33,6 @@ static bool parse_movement_direction(const char *name, enum movement_direction *
struct cmd_results *cmd_focus(int argc, char **argv) { struct cmd_results *cmd_focus(int argc, char **argv) {
swayc_t *con = config->handler_context.current_container; swayc_t *con = config->handler_context.current_container;
struct sway_seat *seat = config->handler_context.seat; 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) { if (con->type < C_WORKSPACE) {
return cmd_results_new(CMD_FAILURE, "focus", return cmd_results_new(CMD_FAILURE, "focus",
"Command 'focus' cannot be used above the workspace level"); "Command 'focus' cannot be used above the workspace level");

View file

@ -6,14 +6,6 @@
#include "sway/commands.h" #include "sway/commands.h"
struct cmd_results *cmd_kill(int argc, char **argv) { 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; enum swayc_types type = config->handler_context.current_container->type;
if (type != C_VIEW && type != C_CONTAINER) { if (type != C_VIEW && type != C_CONTAINER) {
return cmd_results_new(CMD_INVALID, NULL, return cmd_results_new(CMD_INVALID, NULL,

View file

@ -7,19 +7,10 @@
struct cmd_results *cmd_layout(int argc, char **argv) { struct cmd_results *cmd_layout(int argc, char **argv) {
struct cmd_results *error = NULL; 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))) { if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) {
return error; return error;
} }
swayc_t *parent = config->handler_context.current_container; swayc_t *parent = config->handler_context.current_container;
if (!sway_assert(parent != NULL, "command called without container context")) {
return NULL;
}
// TODO: floating // TODO: floating
/* /*

View file

@ -4,9 +4,6 @@
struct cmd_results *cmd_reload(int argc, char **argv) { struct cmd_results *cmd_reload(int argc, char **argv) {
struct cmd_results *error = NULL; 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))) { if ((error = checkarg(argc, "reload", EXPECTED_EQUAL_TO, 0))) {
return error; return error;
} }