summaryrefslogtreecommitdiffstats
path: root/sway/commands/input/scroll_method.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-09-23 19:56:52 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-09-23 19:56:52 -0400
commitbaeb28ea6230ef9aa409ee52abe208720120e45c (patch)
treed5a6fffc3470b3fbbb18a6ae01851451bea1dbb2 /sway/commands/input/scroll_method.c
parentMerge pull request #2699 from RedSoxFan/fix-2667 (diff)
downloadsway-baeb28ea6230ef9aa409ee52abe208720120e45c.tar.gz
sway-baeb28ea6230ef9aa409ee52abe208720120e45c.tar.zst
sway-baeb28ea6230ef9aa409ee52abe208720120e45c.zip
Implement support for input wildcard
Diffstat (limited to 'sway/commands/input/scroll_method.c')
-rw-r--r--sway/commands/input/scroll_method.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sway/commands/input/scroll_method.c b/sway/commands/input/scroll_method.c
index 4c6ac6b6..c116b052 100644
--- a/sway/commands/input/scroll_method.c
+++ b/sway/commands/input/scroll_method.c
@@ -9,29 +9,24 @@ struct cmd_results *input_cmd_scroll_method(int argc, char **argv) {
9 if ((error = checkarg(argc, "scroll_method", EXPECTED_AT_LEAST, 1))) { 9 if ((error = checkarg(argc, "scroll_method", 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, "scroll_method", 14 return cmd_results_new(CMD_FAILURE, "scroll_method",
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], "none") == 0) { 18 if (strcasecmp(argv[0], "none") == 0) {
22 new_config->scroll_method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL; 19 ic->scroll_method = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
23 } else if (strcasecmp(argv[0], "two_finger") == 0) { 20 } else if (strcasecmp(argv[0], "two_finger") == 0) {
24 new_config->scroll_method = LIBINPUT_CONFIG_SCROLL_2FG; 21 ic->scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
25 } else if (strcasecmp(argv[0], "edge") == 0) { 22 } else if (strcasecmp(argv[0], "edge") == 0) {
26 new_config->scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE; 23 ic->scroll_method = LIBINPUT_CONFIG_SCROLL_EDGE;
27 } else if (strcasecmp(argv[0], "on_button_down") == 0) { 24 } else if (strcasecmp(argv[0], "on_button_down") == 0) {
28 new_config->scroll_method = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN; 25 ic->scroll_method = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
29 } else { 26 } else {
30 free_input_config(new_config);
31 return cmd_results_new(CMD_INVALID, "scroll_method", 27 return cmd_results_new(CMD_INVALID, "scroll_method",
32 "Expected 'scroll_method <none|two_finger|edge|on_button_down>'"); 28 "Expected 'scroll_method <none|two_finger|edge|on_button_down>'");
33 } 29 }
34 30
35 apply_input_config(new_config);
36 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 31 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
37} 32}