aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-19 20:17:48 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-19 20:17:48 +1000
commit32806d16ee26174f28e7f4727553aacee1cd3452 (patch)
treee3ba7251e8cdb4a8dc2fb87f5e7a201fadde7151 /sway/commands
parent08736255a3ba16f6b810fd4eee91fe4e1ab92e35 (diff)
Use parse_movement_direction
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/focus.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 894025ad..9cd8bfae 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -57,15 +57,8 @@ static struct cmd_results *focus_output(struct sway_container *con,
if (!output) {
enum movement_direction direction;
- if (strcmp(identifier, "left") == 0) {
- direction = MOVE_LEFT;
- } else if (strcmp(identifier, "right") == 0) {
- direction = MOVE_RIGHT;
- } else if (strcmp(identifier, "up") == 0) {
- direction = MOVE_UP;
- } else if (strcmp(identifier, "down") == 0) {
- direction = MOVE_DOWN;
- } else {
+ if (!parse_movement_direction(identifier, &direction) ||
+ direction == MOVE_PARENT || direction == MOVE_CHILD) {
free(identifier);
return cmd_results_new(CMD_INVALID, "focus",
"There is no output with that name");