diff options
Diffstat (limited to 'sway/commands/input/events.c')
-rw-r--r-- | sway/commands/input/events.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c new file mode 100644 index 00000000..2f13e30a --- /dev/null +++ b/sway/commands/input/events.c | |||
@@ -0,0 +1,29 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/input.h" | ||
4 | #include "log.h" | ||
5 | |||
6 | struct cmd_results *input_cmd_events(int argc, char **argv) { | ||
7 | sway_log(L_DEBUG, "events for device: %s", current_input_config->identifier); | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | if (!current_input_config) { | ||
13 | return cmd_results_new(CMD_FAILURE, "events", "No input device defined."); | ||
14 | } | ||
15 | struct input_config *new_config = new_input_config(current_input_config->identifier); | ||
16 | |||
17 | if (strcasecmp(argv[0], "enabled") == 0) { | ||
18 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; | ||
19 | } else if (strcasecmp(argv[0], "disabled") == 0) { | ||
20 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; | ||
21 | } else if (strcasecmp(argv[0], "disabled_on_external_mouse") == 0) { | ||
22 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; | ||
23 | } else { | ||
24 | return cmd_results_new(CMD_INVALID, "events", "Expected 'events <enabled|disabled|disabled_on_external_mouse>'"); | ||
25 | } | ||
26 | |||
27 | input_cmd_apply(new_config); | ||
28 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
29 | } | ||