From: Pawel S. Veselov Date: Sat, 9 Dec 2017 14:12:25 +0000 (+0100) Subject: Fixes #3072, Xft.dpi can be floating point X-Git-Tag: 4.15~31^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d2b35388b4a4626f3c57f18a470bf1244eaee837;p=i3%2Fi3 Fixes #3072, Xft.dpi can be floating point --- diff --git a/libi3/dpi.c b/libi3/dpi.c index 93a3c6f6..a2c40319 100644 --- a/libi3/dpi.c +++ b/libi3/dpi.c @@ -43,12 +43,13 @@ void init_dpi(void) { } char *endptr; - dpi = strtol(resource, &endptr, 10); - if (dpi == LONG_MAX || dpi == LONG_MIN || dpi < 0 || *endptr != '\0' || endptr == resource) { + double in_dpi = strtod(resource, &endptr); + if (in_dpi == HUGE_VAL || dpi < 0 || *endptr != '\0' || endptr == resource) { ELOG("Xft.dpi = %s is an invalid number and couldn't be parsed.\n", resource); dpi = 0; goto init_dpi_end; } + dpi = (long)round(in_dpi); DLOG("Found Xft.dpi = %ld.\n", dpi);