diff options
Diffstat (limited to 'sway/commands/input/tap.c')
-rw-r--r-- | sway/commands/input/tap.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sway/commands/input/tap.c b/sway/commands/input/tap.c index 9e3ca2af..e7f03058 100644 --- a/sway/commands/input/tap.c +++ b/sway/commands/input/tap.c | |||
@@ -1,29 +1,34 @@ | |||
1 | #include <string.h> | 1 | #include <string.h> |
2 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include "sway/config.h" | ||
3 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
4 | #include "sway/input.h" | 5 | #include "sway/input/input-manager.h" |
5 | #include "log.h" | 6 | #include "log.h" |
6 | 7 | ||
7 | struct cmd_results *input_cmd_tap(int argc, char **argv) { | 8 | struct cmd_results *input_cmd_tap(int argc, char **argv) { |
8 | sway_log(L_DEBUG, "tap for device: %s", current_input_config->identifier); | ||
9 | struct cmd_results *error = NULL; | 9 | struct cmd_results *error = NULL; |
10 | if ((error = checkarg(argc, "tap", EXPECTED_AT_LEAST, 1))) { | 10 | if ((error = checkarg(argc, "tap", EXPECTED_AT_LEAST, 1))) { |
11 | return error; | 11 | return error; |
12 | } | 12 | } |
13 | struct input_config *current_input_config = | ||
14 | config->handler_context.input_config; | ||
13 | if (!current_input_config) { | 15 | if (!current_input_config) { |
14 | return cmd_results_new(CMD_FAILURE, "tap", "No input device defined."); | 16 | return cmd_results_new(CMD_FAILURE, "tap", "No input device defined."); |
15 | } | 17 | } |
16 | struct input_config *new_config = new_input_config(current_input_config->identifier); | 18 | struct input_config *new_config = |
19 | new_input_config(current_input_config->identifier); | ||
17 | 20 | ||
18 | if (strcasecmp(argv[0], "enabled") == 0) { | 21 | if (strcasecmp(argv[0], "enabled") == 0) { |
19 | new_config->tap = LIBINPUT_CONFIG_TAP_ENABLED; | 22 | new_config->tap = LIBINPUT_CONFIG_TAP_ENABLED; |
20 | } else if (strcasecmp(argv[0], "disabled") == 0) { | 23 | } else if (strcasecmp(argv[0], "disabled") == 0) { |
21 | new_config->tap = LIBINPUT_CONFIG_TAP_DISABLED; | 24 | new_config->tap = LIBINPUT_CONFIG_TAP_DISABLED; |
22 | } else { | 25 | } else { |
23 | return cmd_results_new(CMD_INVALID, "tap", "Expected 'tap <enabled|disabled>'"); | 26 | return cmd_results_new(CMD_INVALID, "tap", |
27 | "Expected 'tap <enabled|disabled>'"); | ||
24 | } | 28 | } |
25 | 29 | ||
26 | sway_log(L_DEBUG, "apply-tap for device: %s", current_input_config->identifier); | 30 | wlr_log(L_DEBUG, "apply-tap for device: %s", |
27 | input_cmd_apply(new_config); | 31 | current_input_config->identifier); |
32 | apply_input_config(new_config); | ||
28 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 33 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
29 | } | 34 | } |