diff options
Diffstat (limited to 'sway/commands/input/middle_emulation.c')
-rw-r--r-- | sway/commands/input/middle_emulation.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sway/commands/input/middle_emulation.c b/sway/commands/input/middle_emulation.c index 414d4d2b..80d26838 100644 --- a/sway/commands/input/middle_emulation.c +++ b/sway/commands/input/middle_emulation.c | |||
@@ -10,22 +10,17 @@ struct cmd_results *input_cmd_middle_emulation(int argc, char **argv) { | |||
10 | if ((error = checkarg(argc, "middle_emulation", EXPECTED_AT_LEAST, 1))) { | 10 | if ((error = checkarg(argc, "middle_emulation", 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, "middle_emulation", | 15 | return cmd_results_new(CMD_FAILURE, "middle_emulation", |
17 | "No input device defined."); | 16 | "No input device defined."); |
18 | } | 17 | } |
19 | struct input_config *new_config = | ||
20 | new_input_config(current_input_config->identifier); | ||
21 | 18 | ||
22 | if (parse_boolean(argv[0], true)) { | 19 | if (parse_boolean(argv[0], true)) { |
23 | new_config->middle_emulation = LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED; | 20 | ic->middle_emulation = LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED; |
24 | } else { | 21 | } else { |
25 | new_config->middle_emulation = | 22 | ic->middle_emulation = LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED; |
26 | LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED; | ||
27 | } | 23 | } |
28 | 24 | ||
29 | apply_input_config(new_config); | ||
30 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 25 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
31 | } | 26 | } |