summaryrefslogtreecommitdiffstats
path: root/sway/commands/input/click_method.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2017-12-11 04:17:14 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2017-12-11 07:55:01 -0500
commit462a451328a1d6f0b17d34b431d6bf3dec87c1ba (patch)
tree56649e0702d13e8a7dd5143b5b7d2b9db094a1a7 /sway/commands/input/click_method.c
parentsway pointer (diff)
downloadsway-462a451328a1d6f0b17d34b431d6bf3dec87c1ba.tar.gz
sway-462a451328a1d6f0b17d34b431d6bf3dec87c1ba.tar.zst
sway-462a451328a1d6f0b17d34b431d6bf3dec87c1ba.zip
input config
Diffstat (limited to 'sway/commands/input/click_method.c')
-rw-r--r--sway/commands/input/click_method.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sway/commands/input/click_method.c b/sway/commands/input/click_method.c
new file mode 100644
index 00000000..40f075ce
--- /dev/null
+++ b/sway/commands/input/click_method.c
@@ -0,0 +1,30 @@
1#include <string.h>
2#include <strings.h>
3#include "sway/commands.h"
4#include "sway/input/input-manager.h"
5#include "log.h"
6
7struct cmd_results *input_cmd_click_method(int argc, char **argv) {
8 sway_log(L_DEBUG, "click_method for device: %d %s", current_input_config==NULL, current_input_config->identifier);
9 struct cmd_results *error = NULL;
10 if ((error = checkarg(argc, "click_method", EXPECTED_AT_LEAST, 1))) {
11 return error;
12 }
13 if (!current_input_config) {
14 return cmd_results_new(CMD_FAILURE, "click_method", "No input device defined.");
15 }
16 struct input_config *new_config = new_input_config(current_input_config->identifier);
17
18 if (strcasecmp(argv[0], "none") == 0) {
19 new_config->click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
20 } else if (strcasecmp(argv[0], "button_areas") == 0) {
21 new_config->click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
22 } else if (strcasecmp(argv[0], "clickfinger") == 0) {
23 new_config->click_method = LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER;
24 } else {
25 return cmd_results_new(CMD_INVALID, "click_method", "Expected 'click_method <none|button_areas|clickfinger'");
26 }
27
28 input_cmd_apply(new_config);
29 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
30}