Merge pull request #3073 from veselov/i3-3072

Fixes #3072, Xft.dpi can be floating point
This commit is contained in:
Ingo Bürk 2017-12-09 15:34:13 +01:00 committed by GitHub
commit 23cfbc54c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -43,12 +43,13 @@ void init_dpi(void) {
} }
char *endptr; char *endptr;
dpi = strtol(resource, &endptr, 10); double in_dpi = strtod(resource, &endptr);
if (dpi == LONG_MAX || dpi == LONG_MIN || dpi < 0 || *endptr != '\0' || endptr == resource) { 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); ELOG("Xft.dpi = %s is an invalid number and couldn't be parsed.\n", resource);
dpi = 0; dpi = 0;
goto init_dpi_end; goto init_dpi_end;
} }
dpi = (long)round(in_dpi);
DLOG("Found Xft.dpi = %ld.\n", dpi); DLOG("Found Xft.dpi = %ld.\n", dpi);