diff options
author | Spencer Michaels <spencer@smichaels.net> | 2018-11-17 14:31:33 -0500 |
---|---|---|
committer | Spencer Michaels <spencer@smichaels.net> | 2018-11-18 13:49:30 -0500 |
commit | 70bc4c3ab6c408850543d827f788ef310fdb269c (patch) | |
tree | 265d4ea923f1329d1e7661c0f92a242337318d58 /common | |
parent | b87250425fe13149e41b346f15c5cf808f376438 (diff) |
Add scroll factor config option.
Diffstat (limited to 'common')
-rw-r--r-- | common/util.c | 12 |
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: |