From: Michael Stapelberg Date: Sat, 23 Aug 2014 14:02:30 +0000 (+0200) Subject: Treat everything up to 120 dpi as 96 dpi (Thanks jefvel) X-Git-Tag: 4.9~56 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=33d1d5d3c61a2136eb4b42ffd29870fd68d2d766 Treat everything up to 120 dpi as 96 dpi (Thanks jefvel) See the comment in the source for rationale. --- diff --git a/libi3/dpi.c b/libi3/dpi.c index 090a6560..37d5b215 100644 --- a/libi3/dpi.c +++ b/libi3/dpi.c @@ -1,3 +1,10 @@ +/* + * vim:ts=4:sw=4:expandtab + * + * i3 - an improved dynamic tiling window manager + * © 2009-2014 Michael Stapelberg and contributors (see also: LICENSE) + * + */ #include "libi3.h" #include @@ -12,5 +19,13 @@ extern xcb_screen_t *root_screen; int logical_px(const int logical) { const int dpi = (double)root_screen->height_in_pixels * 25.4 / (double)root_screen->height_in_millimeters; + /* There are many misconfigurations out there, i.e. systems with screens + * whose dpi is in fact higher than 96 dpi, but not significantly higher, + * so software was never adapted. We could tell people to reconfigure their + * systems to 96 dpi in order to get the behavior they expect/are used to, + * but since we can easily detect this case in code, let’s do it for them. + */ + if ((dpi / 96.0) < 1.25) + return logical; return ceil((dpi / 96.0) * logical); }