diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-08-09 23:04:37 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-08-09 23:04:37 -0400 |
commit | f6e65b6bb235cd77329e961e180e2236312ebacc (patch) | |
tree | 1cef31857263d39c1ce189e1b12c08d5c181d046 | |
parent | Fix bug with focus parent (diff) | |
download | sway-f6e65b6bb235cd77329e961e180e2236312ebacc.tar.gz sway-f6e65b6bb235cd77329e961e180e2236312ebacc.tar.zst sway-f6e65b6bb235cd77329e961e180e2236312ebacc.zip |
Don't override keys if command fails
-rw-r--r-- | sway/commands.c | 8 | ||||
-rw-r--r-- | sway/handlers.c | 3 | ||||
-rw-r--r-- | sway/movement.c | 6 | ||||
-rw-r--r-- | sway/movement.h | 2 |
4 files changed, 9 insertions, 10 deletions
diff --git a/sway/commands.c b/sway/commands.c index 9ce1d83e..40d9d353 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -104,13 +104,13 @@ int cmd_focus(struct sway_config *config, int argc, char **argv) { | |||
104 | return 1; | 104 | return 1; |
105 | } | 105 | } |
106 | if (strcasecmp(argv[0], "left") == 0) { | 106 | if (strcasecmp(argv[0], "left") == 0) { |
107 | move_focus(MOVE_LEFT); | 107 | return move_focus(MOVE_LEFT); |
108 | } else if (strcasecmp(argv[0], "right") == 0) { | 108 | } else if (strcasecmp(argv[0], "right") == 0) { |
109 | move_focus(MOVE_RIGHT); | 109 | return move_focus(MOVE_RIGHT); |
110 | } else if (strcasecmp(argv[0], "up") == 0) { | 110 | } else if (strcasecmp(argv[0], "up") == 0) { |
111 | move_focus(MOVE_UP); | 111 | return move_focus(MOVE_UP); |
112 | } else if (strcasecmp(argv[0], "down") == 0) { | 112 | } else if (strcasecmp(argv[0], "down") == 0) { |
113 | move_focus(MOVE_DOWN); | 113 | return move_focus(MOVE_DOWN); |
114 | } else if (strcasecmp(argv[0], "parent") == 0) { | 114 | } else if (strcasecmp(argv[0], "parent") == 0) { |
115 | swayc_t *current = get_focused_container(&root_container); | 115 | swayc_t *current = get_focused_container(&root_container); |
116 | if (current && current->parent) { | 116 | if (current && current->parent) { |
diff --git a/sway/handlers.c b/sway/handlers.c index 7d45452f..b3f03d07 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -74,8 +74,7 @@ bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers | |||
74 | } | 74 | } |
75 | 75 | ||
76 | if (match) { | 76 | if (match) { |
77 | ret = false; | 77 | ret = handle_command(config, binding->command) == 0; |
78 | handle_command(config, binding->command); | ||
79 | } | 78 | } |
80 | } | 79 | } |
81 | } | 80 | } |
diff --git a/sway/movement.c b/sway/movement.c index 197df7b2..108e2588 100644 --- a/sway/movement.c +++ b/sway/movement.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include "layout.h" | 5 | #include "layout.h" |
6 | #include "movement.h" | 6 | #include "movement.h" |
7 | 7 | ||
8 | void move_focus(enum movement_direction direction) { | 8 | int move_focus(enum movement_direction direction) { |
9 | swayc_t *current = get_focused_container(&root_container); | 9 | swayc_t *current = get_focused_container(&root_container); |
10 | swayc_t *parent = current->parent; | 10 | swayc_t *parent = current->parent; |
11 | 11 | ||
@@ -42,7 +42,7 @@ void move_focus(enum movement_direction direction) { | |||
42 | } else { | 42 | } else { |
43 | unfocus_all(&root_container); | 43 | unfocus_all(&root_container); |
44 | focus_view(parent->children->items[desired]); | 44 | focus_view(parent->children->items[desired]); |
45 | return; | 45 | return 0; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | if (!can_move) { | 48 | if (!can_move) { |
@@ -51,7 +51,7 @@ void move_focus(enum movement_direction direction) { | |||
51 | parent = parent->parent; | 51 | parent = parent->parent; |
52 | if (parent->type == C_ROOT) { | 52 | if (parent->type == C_ROOT) { |
53 | // Nothing we can do | 53 | // Nothing we can do |
54 | return; | 54 | return 1; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |
diff --git a/sway/movement.h b/sway/movement.h index c88b44bd..44e630ff 100644 --- a/sway/movement.h +++ b/sway/movement.h | |||
@@ -11,6 +11,6 @@ enum movement_direction{ | |||
11 | MOVE_DOWN | 11 | MOVE_DOWN |
12 | }; | 12 | }; |
13 | 13 | ||
14 | void move_focus(enum movement_direction direction); | 14 | int move_focus(enum movement_direction direction); |
15 | 15 | ||
16 | #endif | 16 | #endif |