Subject: Re: bug#31288: [PATCH v2] Make cairo build usable

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Tue, 26 Mar 2019 10:25:48 +0900

unarchive 31288
reopen 31288
quit

On Sun, 06 May 2018 21:36:55 +0900,
Ari Roponen wrote:

> [1  <text/plain (7bit)>]
> Eli Zaretskii <[email-masked]> writes:
> 
> > Thanks, pushed to the master branch.
> 
> Thank you very much. However, I just noticed that my patch doesn't work
> with side-by-side split windows. The following patch should fix that.
> 
> [2 0001-Fix-cairo-scrolling-for-side-by-side-windows.patch <text/x-patch (7bit)>]
> >From 788f0fc62881152b03043057fe98178d77a6bb3a Mon Sep 17 00:00:00 2001
> From: Ari Roponen <[email-masked]>
> Date: Sun, 6 May 2018 15:29:28 +0300
> Subject: [PATCH] Fix cairo scrolling for side-by-side windows
> 
> * src/xterm.c (x_scroll_run) [USE_CAIRO]: Fix scrolling for
> side-by-side split windows.
> ---
>  src/xterm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/xterm.c b/src/xterm.c
> index 35e10568fa..3f956d950d 100644
> --- a/src/xterm.c
> +++ b/src/xterm.c
> @@ -4260,6 +4260,7 @@ x_scroll_run (struct window *w, struct run *run)
>  #ifdef USE_CAIRO
>    if (FRAME_CR_CONTEXT (f))
>      {
> +      int wx = WINDOW_LEFT_EDGE_X (w);
>        cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
>  						       width, height);
>        cairo_t *cr = cairo_create (s);
> @@ -4270,8 +4271,8 @@ x_scroll_run (struct window *w, struct run *run)
>  
>        cr = FRAME_CR_CONTEXT (f);
>        cairo_save (cr);
> -      cairo_set_source_surface (cr, s, 0, to_y);
> -      cairo_rectangle (cr, x, to_y, width, height);
> +      cairo_set_source_surface (cr, s, wx, to_y);
> +      cairo_rectangle (cr, wx, to_y, width, height);
>        cairo_fill (cr);
>        cairo_restore (cr);
>        cairo_surface_destroy (s);
> -- 
> 2.17.0
> 

It causes display corruption when scroll bars are on the left.  I
think the patch below will fix it.

				     YAMAMOTO Mitsuharu
				[email-masked]

diff --git a/src/xterm.c b/src/xterm.c
index 1b0c2f5ec5..e3034772a4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4315,7 +4315,6 @@ x_scroll_run (struct window *w, struct run *run)
 #ifdef USE_CAIRO
   if (FRAME_CR_CONTEXT (f))
     {
-      int wx = WINDOW_LEFT_EDGE_X (w);
       cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
 						       width, height);
       cairo_t *cr = cairo_create (s);
@@ -4326,8 +4325,8 @@ x_scroll_run (struct window *w, struct run *run)
 
       cr = FRAME_CR_CONTEXT (f);
       cairo_save (cr);
-      cairo_set_source_surface (cr, s, wx, to_y);
-      cairo_rectangle (cr, wx, to_y, width, height);
+      cairo_set_source_surface (cr, s, x, to_y);
+      cairo_rectangle (cr, x, to_y, width, height);
       cairo_fill (cr);
       cairo_restore (cr);
       cairo_surface_destroy (s);