i3 - improved tiling WM


Log DPI change only if noticeable in logged output

Patch status: needinfo

Patch by Leo Gaspard

Long description:

As "%f" specifier shows only 6 digits, log DPI change only if change is greater
than 1e-6.

To apply this patch, use:
curl http://cr.i3wm.org/patch/375/raw.patch | git am

b/libi3/font.c

15
@@ -6,6 +6,7 @@
16
  *
17
  */
18
 #include <assert.h>
19
+#include <math.h>
20
 #include <stdint.h>
21
 #include <stdlib.h>
22
 #include <string.h>
23
@@ -41,7 +42,7 @@ static PangoLayout *create_layout_with_dpi(cairo_t *cr) {
24
     context = pango_cairo_create_context(cr);
25
     const double dpi = (double)root_screen->height_in_pixels * 25.4 /
26
                        (double)root_screen->height_in_millimeters;
27
-    if (logged_dpi != dpi) {
28
+    if (fabs(logged_dpi - dpi) > 1e-6) {
29
         logged_dpi = dpi;
30
         LOG("X11 root window dictates %f DPI\n", dpi);
31
     } else {