]> git.sur5r.net Git - i3/i3/blobdiff - libi3/dpi.c
Merge pull request #3398 from orestisf1993/i3-save-tree
[i3/i3] / libi3 / dpi.c
index 93a3c6f6a99f1074d333adb3ebdf6250f671beb7..a2c40319a52b492fcd57b6168495cc5d127257af 100644 (file)
@@ -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);