diff options
Diffstat (limited to 'sway/commands/input/click_method.c')
-rw-r--r-- | sway/commands/input/click_method.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sway/commands/input/click_method.c b/sway/commands/input/click_method.c index 5d0d8cc2..4d7e1c93 100644 --- a/sway/commands/input/click_method.c +++ b/sway/commands/input/click_method.c | |||
@@ -10,27 +10,22 @@ struct cmd_results *input_cmd_click_method(int argc, char **argv) { | |||
10 | if ((error = checkarg(argc, "click_method", EXPECTED_AT_LEAST, 1))) { | 10 | if ((error = checkarg(argc, "click_method", 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, "click_method", | 15 | return cmd_results_new(CMD_FAILURE, "click_method", |
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 | if (strcasecmp(argv[0], "none") == 0) { | 19 | if (strcasecmp(argv[0], "none") == 0) { |
23 | new_config->click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE; | 20 | ic->click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE; |
24 | } else if (strcasecmp(argv[0], "button_areas") == 0) { | 21 | } else if (strcasecmp(argv[0], "button_areas") == 0) { |
25 | new_config->click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; | 22 | ic->click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; |
26 | } else if (strcasecmp(argv[0], "clickfinger") == 0) { | 23 | } else if (strcasecmp(argv[0], "clickfinger") == 0) { |
27 | new_config->click_method = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; | 24 | ic->click_method = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; |
28 | } else { | 25 | } else { |
29 | free_input_config(new_config); | ||
30 | return cmd_results_new(CMD_INVALID, "click_method", | 26 | return cmd_results_new(CMD_INVALID, "click_method", |
31 | "Expected 'click_method <none|button_areas|clickfinger'"); | 27 | "Expected 'click_method <none|button_areas|clickfinger'"); |
32 | } | 28 | } |
33 | 29 | ||
34 | apply_input_config(new_config); | ||
35 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 30 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
36 | } | 31 | } |