aboutsummaryrefslogtreecommitdiffstats
path: root/sway/old/commands/input/natural_scroll.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/old/commands/input/natural_scroll.c')
-rw-r--r--sway/old/commands/input/natural_scroll.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/old/commands/input/natural_scroll.c b/sway/old/commands/input/natural_scroll.c
new file mode 100644
index 00000000..7bc8b8d0
--- /dev/null
+++ b/sway/old/commands/input/natural_scroll.c
@@ -0,0 +1,26 @@
1#include <string.h>
2#include <strings.h>
3#include "sway/commands.h"
4#include "sway/input.h"
5
6struct cmd_results *input_cmd_natural_scroll(int argc, char **argv) {
7 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "natural_scroll", EXPECTED_AT_LEAST, 1))) {
9 return error;
10 }
11 if (!current_input_config) {
12 return cmd_results_new(CMD_FAILURE, "natural_scoll", "No input device defined.");
13 }
14 struct input_config *new_config = new_input_config(current_input_config->identifier);
15
16 if (strcasecmp(argv[0], "enabled") == 0) {
17 new_config->natural_scroll = 1;
18 } else if (strcasecmp(argv[0], "disabled") == 0) {
19 new_config->natural_scroll = 0;
20 } else {
21 return cmd_results_new(CMD_INVALID, "natural_scroll", "Expected 'natural_scroll <enabled|disabled>'");
22 }
23
24 input_cmd_apply(new_config);
25 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
26}