aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authortaiyu <taiyu.len@gmail.com>2015-09-15 06:39:24 -0700
committertaiyu <taiyu.len@gmail.com>2015-09-15 06:39:24 -0700
commita18caf6706d9b5640247737ecd9c8589ccf4817b (patch)
tree7910b6d45b245530325be918ae77f47f666eafef /sway
parent0bea2e2122bd573d1f9dc68b5a990c8f2ad3f3f0 (diff)
nomacro
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/sway/commands.c b/sway/commands.c
index c426928e..bbf0bde2 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -34,7 +34,6 @@ static sway_cmd cmd_floating;
static sway_cmd cmd_floating_mod;
static sway_cmd cmd_focus;
static sway_cmd cmd_focus_follows_mouse;
-static sway_cmd cmd_for_window;
static sway_cmd cmd_fullscreen;
static sway_cmd cmd_gaps;
static sway_cmd cmd_kill;
@@ -53,10 +52,6 @@ static sway_cmd cmd_splitv;
static sway_cmd cmd_workspace;
static sway_cmd cmd_ws_auto_back_and_forth;
-#define NO_BIND() if (!config->reading) return CMD_FAILURE;
-#define NO_CONF() if (config->reading) return CMD_FAILURE;
-#define DEFER() if (!config->active) return CMD_DEFER;
-
swayc_t *sp_view;
int sp_index = 0;
@@ -184,7 +179,7 @@ static enum cmd_status cmd_bindsym(int argc, char **argv) {
}
static enum cmd_status cmd_exec_always(int argc, char **argv) {
- DEFER();
+ if (!config->active) return CMD_DEFER;;
if (!checkarg(argc, "exec_always", EXPECTED_MORE_THAN, 0)) {
return CMD_FAILURE;
}
@@ -215,7 +210,8 @@ static enum cmd_status cmd_exec_always(int argc, char **argv) {
}
static enum cmd_status cmd_exec(int argc, char **argv) {
- DEFER();
+ if (!config->active) return CMD_DEFER;;
+
if (config->reloading) {
char *args = join_args(argv, argc);
sway_log(L_DEBUG, "Ignoring 'exec %s' due to reload", args);
@@ -420,7 +416,7 @@ static enum cmd_status cmd_mode(int argc, char **argv) {
int mode_len = strlen(mode_name);
bool mode_make = mode_name[mode_len-1] == '{';
if (mode_make) {
- NO_BIND();
+ if (!config->reading) return CMD_FAILURE;;
// Trim trailing spaces
do {
mode_name[--mode_len] = 0;
@@ -458,7 +454,7 @@ static enum cmd_status cmd_mode(int argc, char **argv) {
}
static enum cmd_status cmd_move(int argc, char **argv) {
- NO_CONF();
+ if (config->reading) return CMD_FAILURE;;
if (!checkarg(argc, "move", EXPECTED_AT_LEAST, 1)) {
return CMD_FAILURE;
}
@@ -529,7 +525,7 @@ static enum cmd_status cmd_move(int argc, char **argv) {
}
static enum cmd_status cmd_orientation(int argc, char **argv) {
- NO_BIND();
+ if (!config->reading) return CMD_FAILURE;;
if (!checkarg(argc, "orientation", EXPECTED_EQUAL_TO, 1)) {
return CMD_FAILURE;
}
@@ -547,7 +543,7 @@ static enum cmd_status cmd_orientation(int argc, char **argv) {
}
static enum cmd_status cmd_output(int argc, char **argv) {
- NO_BIND();
+ if (!config->reading) return CMD_FAILURE;;
if (!checkarg(argc, "output", EXPECTED_AT_LEAST, 1)) {
return CMD_FAILURE;
}
@@ -1007,11 +1003,6 @@ static enum cmd_status cmd_log_colors(int argc, char **argv) {
return CMD_SUCCESS;
}
-__attribute__((unused))
-enum cmd_status cmd_for_window(int argc, char **argv) {
- return CMD_FAILURE;
-}
-
static enum cmd_status cmd_fullscreen(int argc, char **argv) {
if (!checkarg(argc, "fullscreen", EXPECTED_AT_LEAST, 0)
|| config->reading || !config->active) {