diff options
Diffstat (limited to 'sway/commands/input/pointer_accel.c')
-rw-r--r-- | sway/commands/input/pointer_accel.c | 9 |
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 | ||
7 | struct cmd_results *input_cmd_pointer_accel(int argc, char **argv) { | 9 | struct 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 | } |