Subject: bug#33442: 26.1.90; Cairo side-by-side windows scrolling fix should be cherry-picked

From: Ari Roponen <[email-masked]>
Date: Thu, 29 Nov 2018 14:15:41 +0200

Dmitry Gutov <[email-masked]> writes:

> On 22.11.2018 14:19, Ari Roponen wrote:
>
>> That seems to be it: Starting Emacs with
>>    GDK_SCALE=2 emacs -Q
>> shows the problem here, too.
>
> Thanks for that. I've just tried a --with-cairo build with
>
>     GDK_SCALE=1 emacs
>
> and it seems to work well, (even) without your extra patch. Aside from
> the expected problems with toolbar icons and scrollbar (too small),
> which I don't use anyway.

With the following patch, GDK_SCALE=2 seems to work for me.

diff --git a/src/xterm.c b/src/xterm.c
index 3a7e31e712..42ddc4f5b1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -360,10 +360,15 @@ x_begin_cr_clip (struct frame *f, GC gc)
 
       if (! FRAME_CR_SURFACE (f))
         {
+	  int scale = 1;
+#ifdef USE_GTK
+	  scale = xg_get_scale (f);
+#endif
+
 	  FRAME_CR_SURFACE (f) =
 	    cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-					FRAME_PIXEL_WIDTH (f),
-					FRAME_PIXEL_HEIGHT (f));
+					scale * FRAME_PIXEL_WIDTH (f),
+					scale * FRAME_PIXEL_HEIGHT (f));
 	}
       cr = cairo_create (FRAME_CR_SURFACE (f));
       FRAME_CR_CONTEXT (f) = cr;
@@ -999,8 +1004,9 @@ x_update_begin (struct frame *f)
       if (FRAME_GTK_WIDGET (f))
         {
           GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
-          width = gdk_window_get_width (w);
-          height = gdk_window_get_height (w);
+	  int scale = xg_get_scale (f);
+	  width = scale * gdk_window_get_width (w);
+          height = scale * gdk_window_get_height (w);
         }
       else
 #endif