diff options
Diffstat (limited to 'sway/commands/input.c')
-rw-r--r-- | sway/commands/input.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c new file mode 100644 index 00000000..9c9d7600 --- /dev/null +++ b/sway/commands/input.c | |||
@@ -0,0 +1,52 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/input.h" | ||
4 | #include "log.h" | ||
5 | |||
6 | struct cmd_results *cmd_input(int argc, char **argv) { | ||
7 | struct cmd_results *error = NULL; | ||
8 | if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 2))) { | ||
9 | return error; | ||
10 | } | ||
11 | |||
12 | if (config->reading && strcmp("{", argv[1]) == 0) { | ||
13 | current_input_config = new_input_config(argv[0]); | ||
14 | sway_log(L_DEBUG, "entering input block: %s", current_input_config->identifier); | ||
15 | return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL); | ||
16 | } | ||
17 | |||
18 | if (argc > 2) { | ||
19 | int argc_new = argc-2; | ||
20 | char **argv_new = argv+2; | ||
21 | |||
22 | struct cmd_results *res; | ||
23 | current_input_config = new_input_config(argv[0]); | ||
24 | if (strcasecmp("accel_profile", argv[1]) == 0) { | ||
25 | res = input_cmd_accel_profile(argc_new, argv_new); | ||
26 | } else if (strcasecmp("click_method", argv[1]) == 0) { | ||
27 | res = input_cmd_click_method(argc_new, argv_new); | ||
28 | } else if (strcasecmp("drag_lock", argv[1]) == 0) { | ||
29 | res = input_cmd_drag_lock(argc_new, argv_new); | ||
30 | } else if (strcasecmp("dwt", argv[1]) == 0) { | ||
31 | res = input_cmd_dwt(argc_new, argv_new); | ||
32 | } else if (strcasecmp("events", argv[1]) == 0) { | ||
33 | res = input_cmd_events(argc_new, argv_new); | ||
34 | } else if (strcasecmp("middle_emulation", argv[1]) == 0) { | ||
35 | res = input_cmd_middle_emulation(argc_new, argv_new); | ||
36 | } else if (strcasecmp("natural_scroll", argv[1]) == 0) { | ||
37 | res = input_cmd_natural_scroll(argc_new, argv_new); | ||
38 | } else if (strcasecmp("pointer_accel", argv[1]) == 0) { | ||
39 | res = input_cmd_pointer_accel(argc_new, argv_new); | ||
40 | } else if (strcasecmp("scroll_method", argv[1]) == 0) { | ||
41 | res = input_cmd_scroll_method(argc_new, argv_new); | ||
42 | } else if (strcasecmp("tap", argv[1]) == 0) { | ||
43 | res = input_cmd_tap(argc_new, argv_new); | ||
44 | } else { | ||
45 | res = cmd_results_new(CMD_INVALID, "input <device>", "Unknown command %s", argv[1]); | ||
46 | } | ||
47 | current_input_config = NULL; | ||
48 | return res; | ||
49 | } | ||
50 | |||
51 | return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL); | ||
52 | } | ||