diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-09-23 19:56:52 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-09-23 19:56:52 -0400 |
commit | baeb28ea6230ef9aa409ee52abe208720120e45c (patch) | |
tree | d5a6fffc3470b3fbbb18a6ae01851451bea1dbb2 /sway/commands/input/scroll_button.c | |
parent | Merge pull request #2699 from RedSoxFan/fix-2667 (diff) | |
download | sway-baeb28ea6230ef9aa409ee52abe208720120e45c.tar.gz sway-baeb28ea6230ef9aa409ee52abe208720120e45c.tar.zst sway-baeb28ea6230ef9aa409ee52abe208720120e45c.zip |
Implement support for input wildcard
Diffstat (limited to 'sway/commands/input/scroll_button.c')
-rw-r--r-- | sway/commands/input/scroll_button.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sway/commands/input/scroll_button.c b/sway/commands/input/scroll_button.c index 350fcca2..1958f23c 100644 --- a/sway/commands/input/scroll_button.c +++ b/sway/commands/input/scroll_button.c | |||
@@ -10,35 +10,28 @@ struct cmd_results *input_cmd_scroll_button(int argc, char **argv) { | |||
10 | if ((error = checkarg(argc, "scroll_button", EXPECTED_AT_LEAST, 1))) { | 10 | if ((error = checkarg(argc, "scroll_button", EXPECTED_AT_LEAST, 1))) { |
11 | return error; | 11 | return error; |
12 | } | 12 | } |
13 | struct input_config *current_input_config = | 13 | struct input_config *ic = config->handler_context.input_config; |
14 | config->handler_context.input_config; | 14 | if (!ic) { |
15 | if (!current_input_config) { | ||
16 | return cmd_results_new(CMD_FAILURE, "scroll_button", | 15 | return cmd_results_new(CMD_FAILURE, "scroll_button", |
17 | "No input device defined."); | 16 | "No input device defined."); |
18 | } | 17 | } |
19 | struct input_config *new_config = | ||
20 | new_input_config(current_input_config->identifier); | ||
21 | 18 | ||
22 | errno = 0; | 19 | errno = 0; |
23 | char *endptr; | 20 | char *endptr; |
24 | int scroll_button = strtol(*argv, &endptr, 10); | 21 | int scroll_button = strtol(*argv, &endptr, 10); |
25 | if (endptr == *argv && scroll_button == 0) { | 22 | if (endptr == *argv && scroll_button == 0) { |
26 | free_input_config(new_config); | ||
27 | return cmd_results_new(CMD_INVALID, "scroll_button", | 23 | return cmd_results_new(CMD_INVALID, "scroll_button", |
28 | "Scroll button identifier must be an integer."); | 24 | "Scroll button identifier must be an integer."); |
29 | } | 25 | } |
30 | if (errno == ERANGE) { | 26 | if (errno == ERANGE) { |
31 | free_input_config(new_config); | ||
32 | return cmd_results_new(CMD_INVALID, "scroll_button", | 27 | return cmd_results_new(CMD_INVALID, "scroll_button", |
33 | "Scroll button identifier out of range."); | 28 | "Scroll button identifier out of range."); |
34 | } | 29 | } |
35 | if (scroll_button < 0) { | 30 | if (scroll_button < 0) { |
36 | free_input_config(new_config); | ||
37 | return cmd_results_new(CMD_INVALID, "scroll_button", | 31 | return cmd_results_new(CMD_INVALID, "scroll_button", |
38 | "Scroll button identifier cannot be negative."); | 32 | "Scroll button identifier cannot be negative."); |
39 | } | 33 | } |
40 | new_config->scroll_button = scroll_button; | 34 | ic->scroll_button = scroll_button; |
41 | 35 | ||
42 | apply_input_config(new_config); | ||
43 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 36 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
44 | } | 37 | } |