summaryrefslogtreecommitdiffstats
path: root/sway/commands/input/dwt.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-07-23 15:04:46 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-07-23 21:33:17 -0400
commit863914ec9574eb58cb0746d59f216997c4863cdf (patch)
treeaaddd8ae854d1dde4b50cfd4ef470c1acf83b6ce /sway/commands/input/dwt.c
parentMerge pull request #2342 from RyanDwyer/update-cursor (diff)
downloadsway-863914ec9574eb58cb0746d59f216997c4863cdf.tar.gz
sway-863914ec9574eb58cb0746d59f216997c4863cdf.tar.zst
sway-863914ec9574eb58cb0746d59f216997c4863cdf.zip
Switch to using a function to parse booleans
Diffstat (limited to 'sway/commands/input/dwt.c')
-rw-r--r--sway/commands/input/dwt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sway/commands/input/dwt.c b/sway/commands/input/dwt.c
index 73937507..15134268 100644
--- a/sway/commands/input/dwt.c
+++ b/sway/commands/input/dwt.c
@@ -3,6 +3,7 @@
3#include "sway/config.h" 3#include "sway/config.h"
4#include "sway/commands.h" 4#include "sway/commands.h"
5#include "sway/input/input-manager.h" 5#include "sway/input/input-manager.h"
6#include "util.h"
6 7
7struct cmd_results *input_cmd_dwt(int argc, char **argv) { 8struct cmd_results *input_cmd_dwt(int argc, char **argv) {
8 struct cmd_results *error = NULL; 9 struct cmd_results *error = NULL;
@@ -17,14 +18,10 @@ struct cmd_results *input_cmd_dwt(int argc, char **argv) {
17 struct input_config *new_config = 18 struct input_config *new_config =
18 new_input_config(current_input_config->identifier); 19 new_input_config(current_input_config->identifier);
19 20
20 if (strcasecmp(argv[0], "enabled") == 0) { 21 if (parse_boolean(argv[0], true)) {
21 new_config->dwt = LIBINPUT_CONFIG_DWT_ENABLED; 22 new_config->dwt = LIBINPUT_CONFIG_DWT_ENABLED;
22 } else if (strcasecmp(argv[0], "disabled") == 0) {
23 new_config->dwt = LIBINPUT_CONFIG_DWT_DISABLED;
24 } else { 23 } else {
25 free_input_config(new_config); 24 new_config->dwt = LIBINPUT_CONFIG_DWT_DISABLED;
26 return cmd_results_new(CMD_INVALID, "dwt",
27 "Expected 'dwt <enabled|disabled>'");
28 } 25 }
29 26
30 apply_input_config(new_config); 27 apply_input_config(new_config);