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/util.c | |
parent | Merge pull request #3147 from emersion/set10 (diff) | |
download | sway-70bc4c3ab6c408850543d827f788ef310fdb269c.tar.gz sway-70bc4c3ab6c408850543d827f788ef310fdb269c.tar.zst sway-70bc4c3ab6c408850543d827f788ef310fdb269c.zip |
Add scroll factor config option.
Diffstat (limited to 'common/util.c')
-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 @@ | |||
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <sys/stat.h> | 4 | #include <sys/stat.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include <float.h> | ||
6 | #include <math.h> | 7 | #include <math.h> |
7 | #include <stdint.h> | 8 | #include <stdint.h> |
8 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -140,6 +141,17 @@ bool parse_boolean(const char *boolean, bool current) { | |||
140 | return false; | 141 | return false; |
141 | } | 142 | } |
142 | 143 | ||
144 | float parse_float(const char *value) { | ||
145 | errno = 0; | ||
146 | char *end; | ||
147 | float flt = strtof(value, &end); | ||
148 | if (*end || errno) { | ||
149 | wlr_log(WLR_DEBUG, "Invalid float value '%s', defaulting to NAN", value); | ||
150 | return NAN; | ||
151 | } | ||
152 | return flt; | ||
153 | } | ||
154 | |||
143 | enum wlr_direction opposite_direction(enum wlr_direction d) { | 155 | enum wlr_direction opposite_direction(enum wlr_direction d) { |
144 | switch (d) { | 156 | switch (d) { |
145 | case WLR_DIRECTION_UP: | 157 | case WLR_DIRECTION_UP: |