diff options
Diffstat (limited to 'sway/commands/bind.c')
-rw-r--r-- | sway/commands/bind.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 701d9746..5832d01e 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c | |||
@@ -26,6 +26,7 @@ void free_sway_binding(struct sway_binding *binding) { | |||
26 | if (binding->keys) { | 26 | if (binding->keys) { |
27 | free_flat_list(binding->keys); | 27 | free_flat_list(binding->keys); |
28 | } | 28 | } |
29 | free(binding->input); | ||
29 | free(binding->command); | 30 | free(binding->command); |
30 | free(binding); | 31 | free(binding); |
31 | } | 32 | } |
@@ -37,6 +38,10 @@ void free_sway_binding(struct sway_binding *binding) { | |||
37 | */ | 38 | */ |
38 | static bool binding_key_compare(struct sway_binding *binding_a, | 39 | static bool binding_key_compare(struct sway_binding *binding_a, |
39 | struct sway_binding *binding_b) { | 40 | struct sway_binding *binding_b) { |
41 | if (strcmp(binding_a->input, binding_b->input) != 0) { | ||
42 | return false; | ||
43 | } | ||
44 | |||
40 | if (binding_a->type != binding_b->type) { | 45 | if (binding_a->type != binding_b->type) { |
41 | return false; | 46 | return false; |
42 | } | 47 | } |
@@ -149,6 +154,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, | |||
149 | return cmd_results_new(CMD_FAILURE, bindtype, | 154 | return cmd_results_new(CMD_FAILURE, bindtype, |
150 | "Unable to allocate binding"); | 155 | "Unable to allocate binding"); |
151 | } | 156 | } |
157 | binding->input = strdup("*"); | ||
152 | binding->keys = create_list(); | 158 | binding->keys = create_list(); |
153 | binding->modifiers = 0; | 159 | binding->modifiers = 0; |
154 | binding->flags = 0; | 160 | binding->flags = 0; |
@@ -168,6 +174,10 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, | |||
168 | binding->flags |= BINDING_BORDER; | 174 | binding->flags |= BINDING_BORDER; |
169 | } else if (strcmp("--exclude-titlebar", argv[0]) == 0) { | 175 | } else if (strcmp("--exclude-titlebar", argv[0]) == 0) { |
170 | exclude_titlebar = true; | 176 | exclude_titlebar = true; |
177 | } else if (strncmp("--input-device=", argv[0], | ||
178 | strlen("--input-device=")) == 0) { | ||
179 | free(binding->input); | ||
180 | binding->input = strdup(argv[0] + strlen("--input-device=")); | ||
171 | } else { | 181 | } else { |
172 | break; | 182 | break; |
173 | } | 183 | } |
@@ -257,8 +267,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, | |||
257 | list_add(mode_bindings, binding); | 267 | list_add(mode_bindings, binding); |
258 | } | 268 | } |
259 | 269 | ||
260 | wlr_log(WLR_DEBUG, "%s - Bound %s to command %s", | 270 | wlr_log(WLR_DEBUG, "%s - Bound %s to command `%s` for device '%s'", |
261 | bindtype, argv[0], binding->command); | 271 | bindtype, argv[0], binding->command, binding->input); |
262 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 272 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
263 | 273 | ||
264 | } | 274 | } |