aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSpencer Michaels <spencer@smichaels.net>2018-11-17 14:31:33 -0500
committerSpencer Michaels <spencer@smichaels.net>2018-11-18 13:49:30 -0500
commit70bc4c3ab6c408850543d827f788ef310fdb269c (patch)
tree265d4ea923f1329d1e7661c0f92a242337318d58 /common
parentb87250425fe13149e41b346f15c5cf808f376438 (diff)
Add scroll factor config option.
Diffstat (limited to 'common')
-rw-r--r--common/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c
index f4588b57..0caafb39 100644
--- a/common/util.c
+++ b/common/util.c
@@ -3,6 +3,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <float.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
@@ -140,6 +141,17 @@ bool parse_boolean(const char *boolean, bool current) {
return false;
}
+float parse_float(const char *value) {
+ errno = 0;
+ char *end;
+ float flt = strtof(value, &end);
+ if (*end || errno) {
+ wlr_log(WLR_DEBUG, "Invalid float value '%s', defaulting to NAN", value);
+ return NAN;
+ }
+ return flt;
+}
+
enum wlr_direction opposite_direction(enum wlr_direction d) {
switch (d) {
case WLR_DIRECTION_UP: