aboutsummaryrefslogtreecommitdiffstats
path: root/sway/old/commands/input/accel_profile.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/old/commands/input/accel_profile.c')
-rw-r--r--sway/old/commands/input/accel_profile.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sway/old/commands/input/accel_profile.c b/sway/old/commands/input/accel_profile.c
new file mode 100644
index 00000000..8288c1ad
--- /dev/null
+++ b/sway/old/commands/input/accel_profile.c
@@ -0,0 +1,27 @@
1#include <string.h>
2#include <strings.h>
3#include "sway/commands.h"
4#include "sway/input.h"
5
6struct cmd_results *input_cmd_accel_profile(int argc, char **argv) {
7 struct cmd_results *error = NULL;
8 if ((error = checkarg(argc, "accel_profile", EXPECTED_AT_LEAST, 1))) {
9 return error;
10 }
11 if (!current_input_config) {
12 return cmd_results_new(CMD_FAILURE, "accel_profile", "No input device defined.");
13 }
14 struct input_config *new_config = new_input_config(current_input_config->identifier);
15
16 if (strcasecmp(argv[0], "adaptive") == 0) {
17 new_config->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
18 } else if (strcasecmp(argv[0], "flat") == 0) {
19 new_config->accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
20 } else {
21 return cmd_results_new(CMD_INVALID, "accel_profile",
22 "Expected 'accel_profile <adaptive|flat>'");
23 }
24
25 input_cmd_apply(new_config);
26 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
27}