aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/input/dwt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/input/dwt.c')
-rw-r--r--sway/commands/input/dwt.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sway/commands/input/dwt.c b/sway/commands/input/dwt.c
index 557b2207..995a2f47 100644
--- a/sway/commands/input/dwt.c
+++ b/sway/commands/input/dwt.c
@@ -1,26 +1,31 @@
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 6
6struct cmd_results *input_cmd_dwt(int argc, char **argv) { 7struct cmd_results *input_cmd_dwt(int argc, char **argv) {
7 struct cmd_results *error = NULL; 8 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "dwt", EXPECTED_AT_LEAST, 1))) { 9 if ((error = checkarg(argc, "dwt", EXPECTED_AT_LEAST, 1))) {
9 return error; 10 return error;
10 } 11 }
12 struct input_config *current_input_config =
13 config->handler_context.input_config;
11 if (!current_input_config) { 14 if (!current_input_config) {
12 return cmd_results_new(CMD_FAILURE, "dwt", "No input device defined."); 15 return cmd_results_new(CMD_FAILURE, "dwt", "No input device defined.");
13 } 16 }
14 struct input_config *new_config = new_input_config(current_input_config->identifier); 17 struct input_config *new_config =
18 new_input_config(current_input_config->identifier);
15 19
16 if (strcasecmp(argv[0], "enabled") == 0) { 20 if (strcasecmp(argv[0], "enabled") == 0) {
17 new_config->dwt = LIBINPUT_CONFIG_DWT_ENABLED; 21 new_config->dwt = LIBINPUT_CONFIG_DWT_ENABLED;
18 } else if (strcasecmp(argv[0], "disabled") == 0) { 22 } else if (strcasecmp(argv[0], "disabled") == 0) {
19 new_config->dwt = LIBINPUT_CONFIG_DWT_DISABLED; 23 new_config->dwt = LIBINPUT_CONFIG_DWT_DISABLED;
20 } else { 24 } else {
21 return cmd_results_new(CMD_INVALID, "dwt", "Expected 'dwt <enabled|disabled>'"); 25 return cmd_results_new(CMD_INVALID, "dwt",
26 "Expected 'dwt <enabled|disabled>'");
22 } 27 }
23 28
24 input_cmd_apply(new_config); 29 apply_input_config(new_config);
25 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 30 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
26} 31}