diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-12 20:19:54 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-12 20:19:54 -0400 |
commit | cd1b32453a9296c18b28bff71607aeb22987b5cd (patch) | |
tree | c653c6d525b471914c01a9d7ae543f521b6138ed /sway/commands/input/events.c | |
parent | Merge pull request #1634 from aleksander/master (diff) | |
parent | Fix separator height calculation (diff) | |
download | sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.tar.gz sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.tar.zst sway-cd1b32453a9296c18b28bff71607aeb22987b5cd.zip |
Merge branch 'wlroots'
Diffstat (limited to 'sway/commands/input/events.c')
-rw-r--r-- | sway/commands/input/events.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c index 9d54287a..2217f5ce 100644 --- a/sway/commands/input/events.c +++ b/sway/commands/input/events.c | |||
@@ -1,30 +1,38 @@ | |||
1 | #include <string.h> | 1 | #include <string.h> |
2 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include "sway/config.h" | ||
3 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
4 | #include "sway/input.h" | 5 | #include "sway/input/input-manager.h" |
5 | #include "log.h" | 6 | #include "log.h" |
6 | 7 | ||
7 | struct cmd_results *input_cmd_events(int argc, char **argv) { | 8 | struct cmd_results *input_cmd_events(int argc, char **argv) { |
8 | sway_log(L_DEBUG, "events for device: %s", current_input_config->identifier); | ||
9 | struct cmd_results *error = NULL; | 9 | struct cmd_results *error = NULL; |
10 | if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) { | 10 | if ((error = checkarg(argc, "events", EXPECTED_AT_LEAST, 1))) { |
11 | return error; | 11 | return error; |
12 | } | 12 | } |
13 | struct input_config *current_input_config = | ||
14 | config->handler_context.input_config; | ||
13 | if (!current_input_config) { | 15 | if (!current_input_config) { |
14 | return cmd_results_new(CMD_FAILURE, "events", "No input device defined."); | 16 | return cmd_results_new(CMD_FAILURE, "events", |
17 | "No input device defined."); | ||
15 | } | 18 | } |
16 | struct input_config *new_config = new_input_config(current_input_config->identifier); | 19 | wlr_log(L_DEBUG, "events for device: %s", |
20 | current_input_config->identifier); | ||
21 | struct input_config *new_config = | ||
22 | new_input_config(current_input_config->identifier); | ||
17 | 23 | ||
18 | if (strcasecmp(argv[0], "enabled") == 0) { | 24 | if (strcasecmp(argv[0], "enabled") == 0) { |
19 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; | 25 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; |
20 | } else if (strcasecmp(argv[0], "disabled") == 0) { | 26 | } else if (strcasecmp(argv[0], "disabled") == 0) { |
21 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; | 27 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; |
22 | } else if (strcasecmp(argv[0], "disabled_on_external_mouse") == 0) { | 28 | } else if (strcasecmp(argv[0], "disabled_on_external_mouse") == 0) { |
23 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; | 29 | new_config->send_events = |
30 | LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; | ||
24 | } else { | 31 | } else { |
25 | return cmd_results_new(CMD_INVALID, "events", "Expected 'events <enabled|disabled|disabled_on_external_mouse>'"); | 32 | return cmd_results_new(CMD_INVALID, "events", |
33 | "Expected 'events <enabled|disabled|disabled_on_external_mouse>'"); | ||
26 | } | 34 | } |
27 | 35 | ||
28 | input_cmd_apply(new_config); | 36 | apply_input_config(new_config); |
29 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 37 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
30 | } | 38 | } |