From 70bc4c3ab6c408850543d827f788ef310fdb269c Mon Sep 17 00:00:00 2001 From: Spencer Michaels Date: Sat, 17 Nov 2018 14:31:33 -0500 Subject: Add scroll factor config option. --- common/util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common') 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 #include #include +#include #include #include #include @@ -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: -- cgit v1.2.3-54-g00ecf