aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/input/pointer_accel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/input/pointer_accel.c')
-rw-r--r--sway/commands/input/pointer_accel.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/commands/input/pointer_accel.c b/sway/commands/input/pointer_accel.c
new file mode 100644
index 00000000..d2261a63
--- /dev/null
+++ b/sway/commands/input/pointer_accel.c
@@ -0,0 +1,28 @@
1#include <stdlib.h>
2#include <string.h>
3#include "sway/config.h"
4#include "sway/commands.h"
5#include "sway/input/input-manager.h"
6
7struct cmd_results *input_cmd_pointer_accel(int argc, char **argv) {
8 struct cmd_results *error = NULL;
9 if ((error = checkarg(argc, "pointer_accel", EXPECTED_AT_LEAST, 1))) {
10 return error;
11 }
12 if (!current_input_config) {
13 return cmd_results_new(CMD_FAILURE,
14 "pointer_accel", "No input device defined.");
15 }
16 struct input_config *new_config =
17 new_input_config(current_input_config->identifier);
18
19 float pointer_accel = atof(argv[0]);
20 if (pointer_accel < -1 || pointer_accel > 1) {
21 return cmd_results_new(CMD_INVALID, "pointer_accel",
22 "Input out of range [-1, 1]");
23 }
24 new_config->pointer_accel = pointer_accel;
25
26 apply_input_config(new_config);
27 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
28}