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/tap_button_map.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/tap_button_map.c')
-rw-r--r-- | sway/commands/input/tap_button_map.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sway/commands/input/tap_button_map.c b/sway/commands/input/tap_button_map.c index bdbba472..dff2985b 100644 --- a/sway/commands/input/tap_button_map.c +++ b/sway/commands/input/tap_button_map.c | |||
@@ -9,25 +9,20 @@ struct cmd_results *input_cmd_tap_button_map(int argc, char **argv) { | |||
9 | if ((error = checkarg(argc, "tap_button_map", EXPECTED_AT_LEAST, 1))) { | 9 | if ((error = checkarg(argc, "tap_button_map", EXPECTED_AT_LEAST, 1))) { |
10 | return error; | 10 | return error; |
11 | } | 11 | } |
12 | struct input_config *current_input_config = | 12 | struct input_config *ic = config->handler_context.input_config; |
13 | config->handler_context.input_config; | 13 | if (!ic) { |
14 | if (!current_input_config) { | ||
15 | return cmd_results_new(CMD_FAILURE, "tap_button_map", | 14 | return cmd_results_new(CMD_FAILURE, "tap_button_map", |
16 | "No input device defined."); | 15 | "No input device defined."); |
17 | } | 16 | } |
18 | struct input_config *new_config = | ||
19 | new_input_config(current_input_config->identifier); | ||
20 | 17 | ||
21 | if (strcasecmp(argv[0], "lrm") == 0) { | 18 | if (strcasecmp(argv[0], "lrm") == 0) { |
22 | new_config->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM; | 19 | ic->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LRM; |
23 | } else if (strcasecmp(argv[0], "lmr") == 0) { | 20 | } else if (strcasecmp(argv[0], "lmr") == 0) { |
24 | new_config->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR; | 21 | ic->tap_button_map = LIBINPUT_CONFIG_TAP_MAP_LMR; |
25 | } else { | 22 | } else { |
26 | free_input_config(new_config); | ||
27 | return cmd_results_new(CMD_INVALID, "tap_button_map", | 23 | return cmd_results_new(CMD_INVALID, "tap_button_map", |
28 | "Expected 'tap_button_map <lrm|lmr>'"); | 24 | "Expected 'tap_button_map <lrm|lmr>'"); |
29 | } | 25 | } |
30 | 26 | ||
31 | apply_input_config(new_config); | ||
32 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 27 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
33 | } | 28 | } |