diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-19 20:17:48 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-07-19 20:17:48 +1000 |
commit | 32806d16ee26174f28e7f4727553aacee1cd3452 (patch) | |
tree | e3ba7251e8cdb4a8dc2fb87f5e7a201fadde7151 | |
parent | Defer the focus commands (diff) | |
download | sway-32806d16ee26174f28e7f4727553aacee1cd3452.tar.gz sway-32806d16ee26174f28e7f4727553aacee1cd3452.tar.zst sway-32806d16ee26174f28e7f4727553aacee1cd3452.zip |
Use parse_movement_direction
-rw-r--r-- | sway/commands/focus.c | 11 |
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, | |||
57 | 57 | ||
58 | if (!output) { | 58 | if (!output) { |
59 | enum movement_direction direction; | 59 | enum movement_direction direction; |
60 | if (strcmp(identifier, "left") == 0) { | 60 | if (!parse_movement_direction(identifier, &direction) || |
61 | direction = MOVE_LEFT; | 61 | direction == MOVE_PARENT || direction == MOVE_CHILD) { |
62 | } else if (strcmp(identifier, "right") == 0) { | ||
63 | direction = MOVE_RIGHT; | ||
64 | } else if (strcmp(identifier, "up") == 0) { | ||
65 | direction = MOVE_UP; | ||
66 | } else if (strcmp(identifier, "down") == 0) { | ||
67 | direction = MOVE_DOWN; | ||
68 | } else { | ||
69 | free(identifier); | 62 | free(identifier); |
70 | return cmd_results_new(CMD_INVALID, "focus", | 63 | return cmd_results_new(CMD_INVALID, "focus", |
71 | "There is no output with that name"); | 64 | "There is no output with that name"); |