summaryrefslogtreecommitdiffstats
path: root/sway/commands/input/pointer_accel.c
diff options
context:
space:
mode:
authorLibravatar Spencer Michaels <spencer@smichaels.net>2018-11-17 14:31:33 -0500
committerLibravatar Spencer Michaels <spencer@smichaels.net>2018-11-18 13:49:30 -0500
commit70bc4c3ab6c408850543d827f788ef310fdb269c (patch)
tree265d4ea923f1329d1e7661c0f92a242337318d58 /sway/commands/input/pointer_accel.c
parentMerge pull request #3147 from emersion/set10 (diff)
downloadsway-70bc4c3ab6c408850543d827f788ef310fdb269c.tar.gz
sway-70bc4c3ab6c408850543d827f788ef310fdb269c.tar.zst
sway-70bc4c3ab6c408850543d827f788ef310fdb269c.zip
Add scroll factor config option.
Diffstat (limited to 'sway/commands/input/pointer_accel.c')
-rw-r--r--sway/commands/input/pointer_accel.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/commands/input/pointer_accel.c b/sway/commands/input/pointer_accel.c
index df487b1c..efd81ee6 100644
--- a/sway/commands/input/pointer_accel.c
+++ b/sway/commands/input/pointer_accel.c
@@ -1,8 +1,10 @@
1#include <math.h>
1#include <stdlib.h> 2#include <stdlib.h>
2#include <string.h> 3#include <string.h>
3#include "sway/config.h" 4#include "sway/config.h"
4#include "sway/commands.h" 5#include "sway/commands.h"
5#include "sway/input/input-manager.h" 6#include "sway/input/input-manager.h"
7#include "util.h"
6 8
7struct cmd_results *input_cmd_pointer_accel(int argc, char **argv) { 9struct cmd_results *input_cmd_pointer_accel(int argc, char **argv) {
8 struct cmd_results *error = NULL; 10 struct cmd_results *error = NULL;
@@ -15,8 +17,11 @@ struct cmd_results *input_cmd_pointer_accel(int argc, char **argv) {
15 "pointer_accel", "No input device defined."); 17 "pointer_accel", "No input device defined.");
16 } 18 }
17 19
18 float pointer_accel = atof(argv[0]); 20 float pointer_accel = parse_float(argv[0]);
19 if (pointer_accel < -1 || pointer_accel > 1) { 21 if (isnan(pointer_accel)) {
22 return cmd_results_new(CMD_INVALID, "pointer_accel",
23 "Invalid pointer accel; expected float.");
24 } if (pointer_accel < -1 || pointer_accel > 1) {
20 return cmd_results_new(CMD_INVALID, "pointer_accel", 25 return cmd_results_new(CMD_INVALID, "pointer_accel",
21 "Input out of range [-1, 1]"); 26 "Input out of range [-1, 1]");
22 } 27 }