diff options
Diffstat (limited to 'sway/commands/input/events.c')
-rw-r--r-- | sway/commands/input/events.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c index abfe3b12..e7ed69c6 100644 --- a/sway/commands/input/events.c +++ b/sway/commands/input/events.c | |||
@@ -10,30 +10,23 @@ struct cmd_results *input_cmd_events(int argc, char **argv) { | |||
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 = | 13 | struct input_config *ic = config->handler_context.input_config; |
14 | config->handler_context.input_config; | 14 | if (!ic) { |
15 | if (!current_input_config) { | ||
16 | return cmd_results_new(CMD_FAILURE, "events", | 15 | return cmd_results_new(CMD_FAILURE, "events", |
17 | "No input device defined."); | 16 | "No input device defined."); |
18 | } | 17 | } |
19 | wlr_log(WLR_DEBUG, "events for device: %s", | ||
20 | current_input_config->identifier); | ||
21 | struct input_config *new_config = | ||
22 | new_input_config(current_input_config->identifier); | ||
23 | 18 | ||
24 | if (strcasecmp(argv[0], "enabled") == 0) { | 19 | if (strcasecmp(argv[0], "enabled") == 0) { |
25 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; | 20 | ic->send_events = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; |
26 | } else if (strcasecmp(argv[0], "disabled") == 0) { | 21 | } else if (strcasecmp(argv[0], "disabled") == 0) { |
27 | new_config->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; | 22 | ic->send_events = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; |
28 | } else if (strcasecmp(argv[0], "disabled_on_external_mouse") == 0) { | 23 | } else if (strcasecmp(argv[0], "disabled_on_external_mouse") == 0) { |
29 | new_config->send_events = | 24 | ic->send_events = |
30 | LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; | 25 | LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; |
31 | } else { | 26 | } else { |
32 | free_input_config(new_config); | ||
33 | return cmd_results_new(CMD_INVALID, "events", | 27 | return cmd_results_new(CMD_INVALID, "events", |
34 | "Expected 'events <enabled|disabled|disabled_on_external_mouse>'"); | 28 | "Expected 'events <enabled|disabled|disabled_on_external_mouse>'"); |
35 | } | 29 | } |
36 | 30 | ||
37 | apply_input_config(new_config); | ||
38 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 31 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
39 | } | 32 | } |