Subject: bug#37689: Fringe pixmaps, widgets, etc. look ridiculously tiny in hidpi screen

From: Carlos Pita <[email-masked]>
Date: Sat, 12 Oct 2019 05:26:54 -0300

Ok, I have arrived at something, I still have to understand the
details but many things are correctly scaled, including widget images.

Icons in the fringe seems to be ok but yet:
1. So checkboxes are weirdly clipped, even if correctly scaled.
2. Not sure about this, but I believe there is a slight vertical misalignment.
3. Default fringe sizes are too small for hidpi screen, they should
change according to screen dpi.

I'm attaching a diff so that you can have an idea of what I am
changing and probably improve on that.
diff --git a/src/xterm.c b/src/xterm.c
index b49c9d6..c07bced 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -608,7 +608,9 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image,
 		 int dest_x, int dest_y, bool overlay_p)
 {
   cairo_t *cr = x_begin_cr_clip (f, gc);
-
+  int scale = xg_get_scale(f);
+  width *= scale;
+  height *= scale;
   if (overlay_p)
     cairo_rectangle (cr, dest_x, dest_y, width, height);
   else
@@ -622,6 +624,7 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image,
 
   cairo_surface_t *surface;
   cairo_pattern_get_surface (image, &surface);
+  cairo_surface_set_device_scale (surface, 1. / scale, 1. / scale);
   cairo_format_t format = cairo_image_surface_get_format (surface);
   if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1)
     {