From unknown Mon Aug 18 11:32:27 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#31288 <31288@debbugs.gnu.org> To: bug#31288 <31288@debbugs.gnu.org> Subject: Status: 27.0.50; [PATCH] Make cairo build somewhat usable Reply-To: bug#31288 <31288@debbugs.gnu.org> Date: Mon, 18 Aug 2025 18:32:27 +0000 retitle 31288 27.0.50; [PATCH] Make cairo build somewhat usable reassign 31288 emacs submitter 31288 Ari Roponen severity 31288 normal tag 31288 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 27 09:19:32 2018 Received: (at submit) by debbugs.gnu.org; 27 Apr 2018 13:19:32 +0000 Received: from localhost ([127.0.0.1]:41027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC3Hf-0002if-Se for submit@debbugs.gnu.org; Fri, 27 Apr 2018 09:19:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34309) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC3He-0002iQ-I3 for submit@debbugs.gnu.org; Fri, 27 Apr 2018 09:19:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC3HX-0004Kn-LB for submit@debbugs.gnu.org; Fri, 27 Apr 2018 09:19:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53623) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fC3HX-0004Kg-Ge for submit@debbugs.gnu.org; Fri, 27 Apr 2018 09:19:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC3HW-00041U-1Y for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC3HU-0004KJ-NN for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:19:21 -0400 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:46667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fC3HU-0004K5-8J for bug-gnu-emacs@gnu.org; Fri, 27 Apr 2018 09:19:20 -0400 Received: by mail-lf0-x235.google.com with SMTP id v85-v6so2633295lfa.13 for ; Fri, 27 Apr 2018 06:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=J4Ji6rWafmJTsNdjxb+BQ58i9qrLJf9PVMPAP2vW4i8=; b=uelrgAb/XgpjmEZGi/Fy2pQ9wp2h57CVSlLT83xm6xzC4uJPl9gJLPoVaD07YPkgHE LE/OdbQJ2V8Cf9ZJZ6YY+2C4tLShow9UiMtaILowb4VL3RLY4uYM4blNvfpne+xPRtrb hzpGGRh3vdI1tttu4zj4qMFFBHtZnPEo9xAZzi5+r24XjLXBP4G4Djs/5itiFFnB6okG 40wpMa+5y3+rCRlYrXcZgaW58uM30H/FIivEbOXzum3zY8lOftLzb+7GjAxErihymjsE wQBxBmXX7SThBLuQ9F9u02+58DP23xAWCsRv8EimHPXu0568KQEOQzGm7mw5hGoC4+6l SOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=J4Ji6rWafmJTsNdjxb+BQ58i9qrLJf9PVMPAP2vW4i8=; b=CBf2YO96zoA2t4b2kcEMa+lPWWyKDqSBubrvnVukD5Z6DhuOLzmSte6+zK95Q2QdAb xmg5eEOUAaPaL0xYNzb4p2+m+1WTQMVoN8tjnbp1cjUhEWPgzvlpBgxZf/SInse9f3JL eT8suvX2LpvE3UTRbvUZ4QA6nsGM7089ZuCxLQY6hTAPbDNXdVrgL2UTs+NWsmRdYLUH wPl7U1sfcdjLk+YCT+51EQGmdVzx3/fnajxhbOVjfJBmY9Yp98Pc8NYs0ZAa8mydjmMj ddcNevO6BbNf83+7HUf6iK+KFmT4W9BwuZqyGvMr3BYLcJ81ROuUzaXIC99+FxcbJox1 Z6vg== X-Gm-Message-State: ALQs6tAP4cYGZTdppMcIHNQXLochfQb6UcJswGmTg64Kk6kTG2ByuKqI MHc82+Ys6pnUY8DoRcuczMithb8= X-Google-Smtp-Source: AB8JxZqornjNxt3bandJQlS10ccKU+2GpVOdGmkZzFDOXDpEyD7J2lCG53FUFeaqDm2VtaOhhroO7A== X-Received: by 2002:a2e:9b89:: with SMTP id z9-v6mr1665366lji.121.1524835158547; Fri, 27 Apr 2018 06:19:18 -0700 (PDT) Received: from arirop ([2001:2003:f7af:fd00:b80b:342a:bead:3c5b]) by smtp.gmail.com with ESMTPSA id b15-v6sm258681lji.25.2018.04.27.06.19.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Apr 2018 06:19:17 -0700 (PDT) From: Ari Roponen To: bug-gnu-emacs@gnu.org Subject: 27.0.50; [PATCH] Make cairo build somewhat usable Date: Fri, 27 Apr 2018 16:19:16 +0300 Message-ID: <87lgd8kcrv.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain Attached are two patches to make --with-cairo builds more usable. First patch tries to fix screen corruption, and the second patch allows cairo builds to display images. These patches are only slightly tested, but I hope they will be useful. In GNU Emacs 27.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-04-27 built on arirop Repository revision: caa93364d47bd28633cc065e31dd5972a1e916d5 Windowing system distributor 'Fedora Project', version 11.0.11906000 System Description: Fedora 28 (Twenty Eight) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-cairo-problems.patch >From 3e93c1a5290bbed7a9b923e1a16f930ec0fbd74a Mon Sep 17 00:00:00 2001 From: Ari Roponen Date: Fri, 27 Apr 2018 15:13:12 +0300 Subject: [PATCH 1/2] Fix cairo problems * src/xterm.c (x_begin_cr_clip): Create image surface. (x_update_end) [USE_CAIRO]: Disable GTK3-specific code for now. (x_scroll_run) [USE_CAIRO]: Implement scrolling. --- src/xterm.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 6ab4a03002..52fe24e0fb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -360,17 +360,12 @@ x_begin_cr_clip (struct frame *f, GC gc) if (! FRAME_CR_SURFACE (f)) { - cairo_surface_t *surface; - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f)); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } - else - cr = cairo_create (FRAME_CR_SURFACE (f)); + FRAME_CR_SURFACE (f) = + cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f)); + } + cr = cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) = cr; } cairo_save (cr); @@ -1236,7 +1231,8 @@ x_update_end (struct frame *f) { cairo_t *cr = 0; block_input(); -#if defined (USE_GTK) && defined (HAVE_GTK3) + /* FIXME */ +#if 0 && defined (USE_GTK) && defined (HAVE_GTK3) if (FRAME_GTK_WIDGET (f)) { GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); @@ -4271,7 +4267,26 @@ x_scroll_run (struct window *w, struct run *run) x_clear_cursor (w); #ifdef USE_CAIRO - SET_FRAME_GARBAGED (f); + if (FRAME_CR_CONTEXT (f)) + { + cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + width, height); + cairo_t *cr = cairo_create (s); + cairo_set_source_surface (cr, cairo_get_target (FRAME_CR_CONTEXT (f)), + -x, -from_y); + cairo_paint (cr); + cairo_destroy (cr); + + 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_fill (cr); + cairo_restore (cr); + cairo_surface_destroy (s); + } else { + SET_FRAME_GARBAGED (f); + } #else XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f), -- 2.17.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Add-partial-image-support-for-cairo-builds.patch >From 6a379d983544b3e1b241860854646ca039724151 Mon Sep 17 00:00:00 2001 From: Ari Roponen Date: Fri, 27 Apr 2018 15:14:36 +0300 Subject: [PATCH 2/2] Add partial image support for cairo builds * src/image.c (lookup_rgb_color): Add cairo support. (jpeg_load_body): Fix preprocessor symbol. Move colors definition into non-cairo part. (imagemagick_load_image) [USE_CAIRO]: Add partial support for cairo. --- src/image.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/image.c b/src/image.c index 37416c1616..4c3f6c5ab0 100644 --- a/src/image.c +++ b/src/image.c @@ -4629,6 +4629,8 @@ lookup_rgb_color (struct frame *f, int r, int g, int b) return PALETTERGB (r >> 8, g >> 8, b >> 8); #elif defined HAVE_NS return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); +#elif defined USE_CAIRO + return (0xffu << 24) | (r << 16) | (g << 8) | b; #else xsignal1 (Qfile_error, build_string ("This Emacs mishandles this image file type")); @@ -6702,10 +6704,10 @@ jpeg_load_body (struct frame *f, struct image *img, FILE *volatile fp = NULL; JSAMPARRAY buffer; int row_stride, x, y; - unsigned long *colors; int width, height; int i, ir, ig, ib; #ifndef USE_CAIRO + unsigned long *colors; XImagePtr ximg = NULL; #endif @@ -6823,7 +6825,7 @@ jpeg_load_body (struct frame *f, struct image *img, else ir = 0, ig = 0, ib = 0; -#ifndef CAIRO +#ifndef USE_CAIRO /* Use the color table mechanism because it handles colors that cannot be allocated nicely. Such colors will be replaced with a default color, and we don't have to care about which colors @@ -8551,6 +8553,9 @@ imagemagick_load_image (struct frame *f, struct image *img, double rotation; char hint_buffer[MaxTextExtent]; char *filename_hint = NULL; +#ifdef USE_CAIRO + void *data; +#endif /* Initialize the ImageMagick environment. */ static bool imagemagick_initialized; @@ -8751,6 +8756,19 @@ imagemagick_load_image (struct frame *f, struct image *img, /* We can now get a valid pixel buffer from the imagemagick file, if all went ok. */ +#ifdef USE_CAIRO + data = xmalloc (width * height * 4); +#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS + MagickExportImagePixels (image_wand, 0, 0, width, height, + "BGRA", CharPixel, data); +#else + /* FIXME: Implement this. For now, make it white. */ + memset(data, 0xff, width * height * 4); +#endif + create_cairo_image_surface (img, data, width, height); + goto done; +#endif /* USE_CAIRO */ + init_color_table (); #if defined (HAVE_MAGICKEXPORTIMAGEPIXELS) && ! defined (HAVE_NS) @@ -8861,6 +8879,9 @@ imagemagick_load_image (struct frame *f, struct image *img, /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); +#ifdef USE_CAIRO + done: +#endif /* Final cleanup. image_wand should be the only resource left. */ DestroyMagickWand (image_wand); if (bg_wand) DestroyPixelWand (bg_wand); -- 2.17.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 27 10:15:45 2018 Received: (at 31288) by debbugs.gnu.org; 27 Apr 2018 14:15:45 +0000 Received: from localhost ([127.0.0.1]:41332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC4A5-00043b-IQ for submit@debbugs.gnu.org; Fri, 27 Apr 2018 10:15:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC4A3-00043O-8f for 31288@debbugs.gnu.org; Fri, 27 Apr 2018 10:15:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC49s-0001F0-Jj for 31288@debbugs.gnu.org; Fri, 27 Apr 2018 10:15:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC49s-0001Er-Fh; Fri, 27 Apr 2018 10:15:32 -0400 Received: from [176.228.60.248] (port=3020 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fC49r-00066e-U7; Fri, 27 Apr 2018 10:15:32 -0400 Date: Fri, 27 Apr 2018 17:15:22 +0300 Message-Id: <83wowsu45h.fsf@gnu.org> From: Eli Zaretskii To: Ari Roponen In-reply-to: <87lgd8kcrv.fsf@gmail.com> (message from Ari Roponen on Fri, 27 Apr 2018 16:19:16 +0300) Subject: Re: bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable References: <87lgd8kcrv.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31288 Cc: 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Ari Roponen > Date: Fri, 27 Apr 2018 16:19:16 +0300 > > Attached are two patches to make --with-cairo builds more usable. > > First patch tries to fix screen corruption, and the second patch allows > cairo builds to display images. Thank you for working on this. Please allow me a couple of minor comments on the changes: > @@ -1236,7 +1231,8 @@ x_update_end (struct frame *f) > { > cairo_t *cr = 0; > block_input(); > -#if defined (USE_GTK) && defined (HAVE_GTK3) > + /* FIXME */ > +#if 0 && defined (USE_GTK) && defined (HAVE_GTK3) > if (FRAME_GTK_WIDGET (f)) > { > GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); This hunk doesn't look right. If the code in question causes some trouble to a Cairo build, please ifdef it out only when USE_CAIRO is defined, not unconditionally. And if that still needs a FIXME comment, please add some description of what needs to be fixed and why. > + cairo_surface_destroy (s); > + } else { > + SET_FRAME_GARBAGED (f); Please use GNU style of braces. Thanks again. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 27 10:36:08 2018 Received: (at 31288) by debbugs.gnu.org; 27 Apr 2018 14:36:08 +0000 Received: from localhost ([127.0.0.1]:41345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC4To-0004XF-HO for submit@debbugs.gnu.org; Fri, 27 Apr 2018 10:36:08 -0400 Received: from mail-lf0-f49.google.com ([209.85.215.49]:35745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC4Tm-0004Wp-LQ for 31288@debbugs.gnu.org; Fri, 27 Apr 2018 10:36:07 -0400 Received: by mail-lf0-f49.google.com with SMTP id r125-v6so3036059lfe.2 for <31288@debbugs.gnu.org>; Fri, 27 Apr 2018 07:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=baa39yPge86/9yTtpl5I0pVwhmZCg9biMtYtkdCwuIY=; b=PYweRw1NHIvnAwg0+xBtHUkZMR8PdOCALf+RDORgnvrfWySgb4wW8J3ChIB9tEccTn BqbqJvTJC+PBCYLbozG9s8Oljq1gbWBvcOW/p3CdyCy/dEHjAUeeLvXdEQiQkMN23/ij UyKdOCrrCfTPmee5QzGhCUsfqnMvBfnXEfEfG6UWFVHGaWLsQyA86/SGcVQiWkdBTtn+ CxS0JWkqrvsNdkpEg4YZj5joDCYehczpHv2MzBYpyx3buJwGjUxHs/S1omtZFQlq0SG2 01yY2R6PsB7wImZJIwWJ7vNOt16jIheTrU7ADWJPWdPeWsKflHFOz3sjnkDxdZiJTMRX G5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=baa39yPge86/9yTtpl5I0pVwhmZCg9biMtYtkdCwuIY=; b=I9p7WGmOtsmkMqOOQzsxrC37meuoVukxfcg1tzK1u7UQPiD7DP7arjYowKGgqbV1ah g4YQa4pLLzgU6/AUQnsws+EOyiHcC1pEeJ6i7dxNglePMAd1ECd/kVIgs278GGZmVGew 5J+t2ovTy6lWwcSG7OL6i7VT1gI1fRl2Horkop5zD/3ABi2wraw60nHOsLwPEIHwfQFG kHuEftO8dfUj2nTqKQZ9D1cuczXLf52Hhti7UQgLfL78wFh6qpK14vzdb+s8h3NABZQS AM2rga5pjWeDsSWCfxlBamFor5IsL3qx4VzG/6GO/CXRRMBCg9AkMR5fcnTkqsiVzb7B 7mgQ== X-Gm-Message-State: ALQs6tAPt3x9evoKvXTixsiZoyvXyuKjb/E80BU4mgBkKhfcC09FmxVv iY/O+Hs980uEgLqIE+8vCBlQBXWpnQ== X-Google-Smtp-Source: AB8JxZpoP37t0p3FoAQ0kxyqb617+QJzWVGH/PrECdrA3KBIYVZni8NTpGhOCswlXC2dN1Eaem8HjA== X-Received: by 2002:a19:d91c:: with SMTP id q28-v6mr1648911lfg.143.1524839760482; Fri, 27 Apr 2018 07:36:00 -0700 (PDT) Received: from arirop ([2001:2003:f7af:fd00:b80b:342a:bead:3c5b]) by smtp.gmail.com with ESMTPSA id k14-v6sm285844ljh.28.2018.04.27.07.35.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Apr 2018 07:35:59 -0700 (PDT) From: Ari Roponen To: Eli Zaretskii Subject: Re: bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable References: <87lgd8kcrv.fsf@gmail.com> <83wowsu45h.fsf@gnu.org> Date: Fri, 27 Apr 2018 17:35:58 +0300 In-Reply-To: <83wowsu45h.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 Apr 2018 17:15:22 +0300") Message-ID: <87y3h8vhrl.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31288 Cc: 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > > Please allow me a couple of minor comments on the changes: > >> @@ -1236,7 +1231,8 @@ x_update_end (struct frame *f) >> { >> cairo_t *cr = 0; >> block_input(); >> -#if defined (USE_GTK) && defined (HAVE_GTK3) >> + /* FIXME */ >> +#if 0 && defined (USE_GTK) && defined (HAVE_GTK3) >> if (FRAME_GTK_WIDGET (f)) >> { >> GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); > > This hunk doesn't look right. If the code in question causes some > trouble to a Cairo build, please ifdef it out only when USE_CAIRO is > defined, not unconditionally. And if that still needs a FIXME > comment, please add some description of what needs to be fixed and > why. > That hunk is inside #ifdef USE_CAIRO, like almost the whole body of x_update_end. >> + cairo_surface_destroy (s); >> + } else { >> + SET_FRAME_GARBAGED (f); > > Please use GNU style of braces. > Done. New patch attached. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-cairo-problems.patch >From dd7b085d569be5f1eb4412e28ac73f3f304eeb0f Mon Sep 17 00:00:00 2001 From: Ari Roponen Date: Fri, 27 Apr 2018 15:13:12 +0300 Subject: [PATCH 1/2] Fix cairo problems * src/xterm.c (x_begin_cr_clip): Create image surface. (x_update_end) [USE_CAIRO]: Disable GTK3-specific code for now. (x_scroll_run) [USE_CAIRO]: Implement scrolling. --- src/xterm.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 6ab4a03002..2a1c7e9edc 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -360,17 +360,12 @@ x_begin_cr_clip (struct frame *f, GC gc) if (! FRAME_CR_SURFACE (f)) { - cairo_surface_t *surface; - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f)); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } - else - cr = cairo_create (FRAME_CR_SURFACE (f)); + FRAME_CR_SURFACE (f) = + cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f)); + } + cr = cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) = cr; } cairo_save (cr); @@ -1236,7 +1231,8 @@ x_update_end (struct frame *f) { cairo_t *cr = 0; block_input(); -#if defined (USE_GTK) && defined (HAVE_GTK3) + /* FIXME */ +#if 0 && defined (USE_GTK) && defined (HAVE_GTK3) if (FRAME_GTK_WIDGET (f)) { GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); @@ -4271,7 +4267,28 @@ x_scroll_run (struct window *w, struct run *run) x_clear_cursor (w); #ifdef USE_CAIRO - SET_FRAME_GARBAGED (f); + if (FRAME_CR_CONTEXT (f)) + { + cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + width, height); + cairo_t *cr = cairo_create (s); + cairo_set_source_surface (cr, cairo_get_target (FRAME_CR_CONTEXT (f)), + -x, -from_y); + cairo_paint (cr); + cairo_destroy (cr); + + 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_fill (cr); + cairo_restore (cr); + cairo_surface_destroy (s); + } + else + { + SET_FRAME_GARBAGED (f); + } #else XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f), -- 2.17.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 27 10:56:19 2018 Received: (at 31288) by debbugs.gnu.org; 27 Apr 2018 14:56:19 +0000 Received: from localhost ([127.0.0.1]:41349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC4nL-0004y4-Av for submit@debbugs.gnu.org; Fri, 27 Apr 2018 10:56:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC4nJ-0004xs-RB for 31288@debbugs.gnu.org; Fri, 27 Apr 2018 10:56:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fC4nB-0008FJ-FV for 31288@debbugs.gnu.org; Fri, 27 Apr 2018 10:56:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fC4nB-0008FC-Bl; Fri, 27 Apr 2018 10:56:09 -0400 Received: from [176.228.60.248] (port=3300 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fC4nA-0007Id-Ip; Fri, 27 Apr 2018 10:56:09 -0400 Date: Fri, 27 Apr 2018 17:55:57 +0300 Message-Id: <83r2n0u29u.fsf@gnu.org> From: Eli Zaretskii To: Ari Roponen In-reply-to: <87y3h8vhrl.fsf@gmail.com> (message from Ari Roponen on Fri, 27 Apr 2018 17:35:58 +0300) Subject: Re: bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable References: <87lgd8kcrv.fsf@gmail.com> <83wowsu45h.fsf@gnu.org> <87y3h8vhrl.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31288 Cc: 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Ari Roponen > Cc: 31288@debbugs.gnu.org > Date: Fri, 27 Apr 2018 17:35:58 +0300 > > >> -#if defined (USE_GTK) && defined (HAVE_GTK3) > >> + /* FIXME */ > >> +#if 0 && defined (USE_GTK) && defined (HAVE_GTK3) > >> if (FRAME_GTK_WIDGET (f)) > >> { > >> GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); > > > > This hunk doesn't look right. If the code in question causes some > > trouble to a Cairo build, please ifdef it out only when USE_CAIRO is > > defined, not unconditionally. And if that still needs a FIXME > > comment, please add some description of what needs to be fixed and > > why. > > > > That hunk is inside #ifdef USE_CAIRO, like almost the whole body of > x_update_end. Ah, sorry I missed that. Still, what is the FIXME there? why not simply remove that part? From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 27 11:52:03 2018 Received: (at 31288) by debbugs.gnu.org; 27 Apr 2018 15:52:03 +0000 Received: from localhost ([127.0.0.1]:41363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC5fG-0006It-Q7 for submit@debbugs.gnu.org; Fri, 27 Apr 2018 11:52:03 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:37421) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fC5fE-0006IQ-VY for 31288@debbugs.gnu.org; Fri, 27 Apr 2018 11:52:01 -0400 Received: by mail-lf0-f42.google.com with SMTP id b23-v6so3375092lfg.4 for <31288@debbugs.gnu.org>; Fri, 27 Apr 2018 08:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=tfa5h+YG1kGQYgFvLgKxwDwFvNdVe6AhVgdow/Gue/w=; b=ZjLP1osHfNDSiBaMsJsA0BFHStvBv1EoT1N96/2NKKDoozPuHq0+T1ry20wO2AGyOQ cY4mBboEspgypifp+RKjZJZeLuUBKm3lsysNO2mPnkjM4A25UOo1Eeb6VvKCqDRHMBGS bMq2QDXiIIcfKpo7/t9IKgkkxrCYLI/jagP6R1TdnngDNloVET005lCae/2dXLaTGmZT fix8BCMDFZKEipyPD/kmu3VHPVsnQySN8xBsEO3dGAajPw/cPazmmAaBnGjzjXqQj0J6 cvWKgSE8LgAjDsXJ5NsO5Vu1oJEr3qrAJmH+UOjn/jVSyWW0paJEkuxxAI9cKR3k3q94 mXGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=tfa5h+YG1kGQYgFvLgKxwDwFvNdVe6AhVgdow/Gue/w=; b=LnP0ILo2k7omaGTKM2wjXFuNB3WzgBU+N8deg9RyJfjfgaX2BO8gWreozbxAds8KQA I/mDC/UpKZoW6v9Bosw8StSIYXz2HULxUvwnTZ2744AG0tyPtOIHQo4KqubrNyLdhybE BvBCtajLne13xLbblEA8OE8Y6/YmU2A6Uo96+6YVkVmklcmBgJiyUmjQe8g5sh5f+xdp pLWwLnVoANRyDMBlnnJ2wmbkiNqQggPxbXj7YZy1rB3I9pJ+puW+j71X4T+qRydFQYvP zZCSqdJF+pXdf626WNMEi+BQ4IRkje3aHQfHkIXiGqJTZH11Necb2QPJx2Xzb/VopR1Q Gx7A== X-Gm-Message-State: ALQs6tBElucK3oGWZAt1CGp4QD0E8jprTZPULgmU3eIw8s9oFWhrLKLt BNpYgthR1P36MfLO4X6Dl5SLbFS0iQ== X-Google-Smtp-Source: AB8JxZrur/JhtDPeP1Rxd/JfRUCCo8CyrNTQYP9/nWdpxcttUAso5ijM+Sf9liH1FwLvhQeH8JfNLw== X-Received: by 2002:a2e:6a07:: with SMTP id f7-v6mr1987713ljc.145.1524844314429; Fri, 27 Apr 2018 08:51:54 -0700 (PDT) Received: from arirop ([2001:2003:f7af:fd00:b80b:342a:bead:3c5b]) by smtp.gmail.com with ESMTPSA id k5-v6sm304085lji.66.2018.04.27.08.51.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Apr 2018 08:51:53 -0700 (PDT) From: Ari Roponen To: Eli Zaretskii Subject: Re: bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable References: <87lgd8kcrv.fsf@gmail.com> <83wowsu45h.fsf@gnu.org> <87y3h8vhrl.fsf@gmail.com> <83r2n0u29u.fsf@gnu.org> Date: Fri, 27 Apr 2018 18:51:52 +0300 In-Reply-To: <83r2n0u29u.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 Apr 2018 17:55:57 +0300") Message-ID: <87r2n0ve93.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31288 Cc: 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > Ah, sorry I missed that. Still, what is the FIXME there? why not > simply remove that part? Ok. Now it's removed. New patch attached. Thank you for your comments. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-cairo-problems.patch >From d54819cb834fddce7488e8f6ebb392a53978b421 Mon Sep 17 00:00:00 2001 From: Ari Roponen Date: Fri, 27 Apr 2018 15:13:12 +0300 Subject: [PATCH 1/2] Fix cairo problems * src/xterm.c (x_begin_cr_clip): Create image surface. (x_update_end) [USE_CAIRO]: Remove GTK3-specific code. (x_scroll_run) [USE_CAIRO]: Implement scrolling. --- src/xterm.c | 83 +++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 6ab4a03002..2f3fe58c2a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -360,17 +360,12 @@ x_begin_cr_clip (struct frame *f, GC gc) if (! FRAME_CR_SURFACE (f)) { - cairo_surface_t *surface; - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f)); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } - else - cr = cairo_create (FRAME_CR_SURFACE (f)); + FRAME_CR_SURFACE (f) = + cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f)); + } + cr = cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) = cr; } cairo_save (cr); @@ -1232,40 +1227,31 @@ x_update_end (struct frame *f) MOUSE_HL_INFO (f)->mouse_face_defer = false; #ifdef USE_CAIRO + block_input(); + if (FRAME_CR_SURFACE (f)) { cairo_t *cr = 0; - block_input(); -#if defined (USE_GTK) && defined (HAVE_GTK3) - if (FRAME_GTK_WIDGET (f)) - { - GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); - cr = gdk_cairo_create (w); - } - else -#endif - { - cairo_surface_t *surface; - int width = FRAME_PIXEL_WIDTH (f); - int height = FRAME_PIXEL_HEIGHT (f); - if (! FRAME_EXTERNAL_TOOL_BAR (f)) - height += FRAME_TOOL_BAR_HEIGHT (f); - if (! FRAME_EXTERNAL_MENU_BAR (f)) - height += FRAME_MENU_BAR_HEIGHT (f); - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - width, - height); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } + cairo_surface_t *surface; + int width = FRAME_PIXEL_WIDTH (f); + int height = FRAME_PIXEL_HEIGHT (f); + if (! FRAME_EXTERNAL_TOOL_BAR (f)) + height += FRAME_TOOL_BAR_HEIGHT (f); + if (! FRAME_EXTERNAL_MENU_BAR (f)) + height += FRAME_MENU_BAR_HEIGHT (f); + surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), + FRAME_X_DRAWABLE (f), + FRAME_DISPLAY_INFO (f)->visual, + width, + height); + cr = cairo_create (surface); + cairo_surface_destroy (surface); cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), 0, 0); cairo_paint (cr); cairo_destroy (cr); - unblock_input (); } + unblock_input (); #endif #ifndef XFlush @@ -4271,7 +4257,28 @@ x_scroll_run (struct window *w, struct run *run) x_clear_cursor (w); #ifdef USE_CAIRO - SET_FRAME_GARBAGED (f); + if (FRAME_CR_CONTEXT (f)) + { + cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + width, height); + cairo_t *cr = cairo_create (s); + cairo_set_source_surface (cr, cairo_get_target (FRAME_CR_CONTEXT (f)), + -x, -from_y); + cairo_paint (cr); + cairo_destroy (cr); + + 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_fill (cr); + cairo_restore (cr); + cairo_surface_destroy (s); + } + else + { + SET_FRAME_GARBAGED (f); + } #else XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f), -- 2.17.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 28 03:33:52 2018 Received: (at 31288) by debbugs.gnu.org; 28 Apr 2018 07:33:52 +0000 Received: from localhost ([127.0.0.1]:41553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCKMh-0003Gd-Fo for submit@debbugs.gnu.org; Sat, 28 Apr 2018 03:33:52 -0400 Received: from mail-lf0-f48.google.com ([209.85.215.48]:33869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fCKMe-0003GO-Kw for 31288@debbugs.gnu.org; Sat, 28 Apr 2018 03:33:49 -0400 Received: by mail-lf0-f48.google.com with SMTP id h4-v6so5766288lfc.1 for <31288@debbugs.gnu.org>; Sat, 28 Apr 2018 00:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version; bh=sHMobkSozHnXuwxxLqVA5x1x2FtE+Prcm1phTkLygrA=; b=cV2+12IEdqM15c0jZ5GVKLx849exNGFI9dPayb3SJNwwLQrNVIoMl2AS+uCbfFBpvi kXL+nLmZYBqkC0nEsFCMYyFeQbwlsuZmhHrzz6Q5/i60nO8ExZdPbgqvZgWFBw25ap0z Q8KVFTjrDK5JqysIdeAaeGupq0Kx1ZItDQ2h8xQ5Zihdrj6woUzRjRfrjWdZqJLAvasG MeKjRKCSLbfpfZ4osFgef453VbKbBUIaN2a6tnMAA91L0tqoayIpqB1eK0ubBbRBaM0x cBvY+iFWGKl6e1LRJLLHRAmKB0lIoWceH/6pjtZs148SrYNnZ67lTd/XFlT/vFgJVjzi 3jzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=sHMobkSozHnXuwxxLqVA5x1x2FtE+Prcm1phTkLygrA=; b=hjEzpKLyuo/68KesqMIBcmEP8a3D1WNKol/YyWtkV7kGfaIdM0PxHPBsDV3jz99Jnt Hg45QzZTUi+DnWhkRrch7AcYZz6nm26s7yHpwRt1UrbpD8Wakh95dY9bpdLfypyzsAGg snhQfStYbjl4k0sVlfLGEmBq/9PAqn2Z8dzA24hpdCOE1Su3Ev4bXXHkDN4gcKCDjmQw enshatiJK72AnEnLjFp3ddTmwmaKPsxqiMfBMTtouMrM0lgCwc7Bye+KSHZARXNWeOtw mgkV6aehuVyoaYQT42RIuD4fsOZgBCDKLfbao4exJum8uTBUeHyMw1oR5bJwreDeRPMx VDvA== X-Gm-Message-State: ALQs6tDjcfTy7wosx749/nh4GdRXfGZeGgXYGx2hFFyXamcySzhVFP88 XwZzvpW3LHl+NITjnAM3bQ== X-Google-Smtp-Source: AB8JxZo/nF4C+i7j6E7uPDrrYSlGiKxldP6hxRl3arN9X6CGGkYyLIDxAhMoDLQIAuE2VLm+ktRW0Q== X-Received: by 2002:a2e:808a:: with SMTP id i10-v6mr3381289ljg.67.1524900822692; Sat, 28 Apr 2018 00:33:42 -0700 (PDT) Received: from arirop ([2001:2003:f7af:fd00:930:26ef:d4a3:c2ea]) by smtp.gmail.com with ESMTPSA id p74-v6sm598396lfe.42.2018.04.28.00.33.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Apr 2018 00:33:41 -0700 (PDT) From: Ari Roponen To: 31288@debbugs.gnu.org Subject: [PATCH v2] Make cairo build usable Date: Sat, 28 Apr 2018 10:33:40 +0300 Message-ID: <87h8nv23aj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31288 Cc: Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi, attached are new versions of patches. This time, the cairo support for imagemagick is better integrated into existing code. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-cairo-problems.patch >From d197ca49c2f0ff6b73e4410ba8e3414f3bbf2e1d Mon Sep 17 00:00:00 2001 From: Ari Roponen Date: Fri, 27 Apr 2018 15:13:12 +0300 Subject: [PATCH 1/2] Fix cairo problems * src/xterm.c (x_begin_cr_clip): Create image surface. (x_update_end) [USE_CAIRO]: Remove GTK3-specific code. (x_scroll_run) [USE_CAIRO]: Implement scrolling. --- src/xterm.c | 84 +++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index 6ab4a03002..35e10568fa 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -360,17 +360,12 @@ x_begin_cr_clip (struct frame *f, GC gc) if (! FRAME_CR_SURFACE (f)) { - cairo_surface_t *surface; - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f)); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } - else - cr = cairo_create (FRAME_CR_SURFACE (f)); + FRAME_CR_SURFACE (f) = + cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f)); + } + cr = cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) = cr; } cairo_save (cr); @@ -1234,32 +1229,24 @@ x_update_end (struct frame *f) #ifdef USE_CAIRO if (FRAME_CR_SURFACE (f)) { - cairo_t *cr = 0; - block_input(); -#if defined (USE_GTK) && defined (HAVE_GTK3) - if (FRAME_GTK_WIDGET (f)) - { - GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); - cr = gdk_cairo_create (w); - } - else -#endif - { - cairo_surface_t *surface; - int width = FRAME_PIXEL_WIDTH (f); - int height = FRAME_PIXEL_HEIGHT (f); - if (! FRAME_EXTERNAL_TOOL_BAR (f)) - height += FRAME_TOOL_BAR_HEIGHT (f); - if (! FRAME_EXTERNAL_MENU_BAR (f)) - height += FRAME_MENU_BAR_HEIGHT (f); - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - width, - height); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } + cairo_t *cr; + cairo_surface_t *surface; + int width, height; + + block_input (); + width = FRAME_PIXEL_WIDTH (f); + height = FRAME_PIXEL_HEIGHT (f); + if (! FRAME_EXTERNAL_TOOL_BAR (f)) + height += FRAME_TOOL_BAR_HEIGHT (f); + if (! FRAME_EXTERNAL_MENU_BAR (f)) + height += FRAME_MENU_BAR_HEIGHT (f); + surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), + FRAME_X_DRAWABLE (f), + FRAME_DISPLAY_INFO (f)->visual, + width, + height); + cr = cairo_create (surface); + cairo_surface_destroy (surface); cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), 0, 0); cairo_paint (cr); @@ -4271,7 +4258,28 @@ x_scroll_run (struct window *w, struct run *run) x_clear_cursor (w); #ifdef USE_CAIRO - SET_FRAME_GARBAGED (f); + if (FRAME_CR_CONTEXT (f)) + { + cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + width, height); + cairo_t *cr = cairo_create (s); + cairo_set_source_surface (cr, cairo_get_target (FRAME_CR_CONTEXT (f)), + -x, -from_y); + cairo_paint (cr); + cairo_destroy (cr); + + 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_fill (cr); + cairo_restore (cr); + cairo_surface_destroy (s); + } + else + { + SET_FRAME_GARBAGED (f); + } #else XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f), -- 2.17.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Fix-image-support-for-cairo-builds.patch >From 3bcf9bb961bbe42ea02191ac22f3ed3bb681c771 Mon Sep 17 00:00:00 2001 From: Ari Roponen Date: Fri, 27 Apr 2018 15:14:36 +0300 Subject: [PATCH 2/2] Fix image support for cairo builds * src/image.c (lookup_rgb_color): Add cairo support. (jpeg_load_body): Fix preprocessor symbol. Move colors definition into non-cairo part. (imagemagick_load_image) [USE_CAIRO]: Add support for cairo. --- src/image.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/image.c b/src/image.c index 37416c1616..4d5a1bf5e6 100644 --- a/src/image.c +++ b/src/image.c @@ -4629,6 +4629,8 @@ lookup_rgb_color (struct frame *f, int r, int g, int b) return PALETTERGB (r >> 8, g >> 8, b >> 8); #elif defined HAVE_NS return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); +#elif defined USE_CAIRO + return (0xffu << 24) | (r << 16) | (g << 8) | b; #else xsignal1 (Qfile_error, build_string ("This Emacs mishandles this image file type")); @@ -6702,10 +6704,10 @@ jpeg_load_body (struct frame *f, struct image *img, FILE *volatile fp = NULL; JSAMPARRAY buffer; int row_stride, x, y; - unsigned long *colors; int width, height; int i, ir, ig, ib; #ifndef USE_CAIRO + unsigned long *colors; XImagePtr ximg = NULL; #endif @@ -6823,7 +6825,7 @@ jpeg_load_body (struct frame *f, struct image *img, else ir = 0, ig = 0, ib = 0; -#ifndef CAIRO +#ifndef USE_CAIRO /* Use the color table mechanism because it handles colors that cannot be allocated nicely. Such colors will be replaced with a default color, and we don't have to care about which colors @@ -8537,7 +8539,9 @@ imagemagick_load_image (struct frame *f, struct image *img, int width, height; size_t image_width, image_height; MagickBooleanType status; +#ifndef USE_CAIRO XImagePtr ximg; +#endif int x, y; MagickWand *image_wand; PixelIterator *iterator; @@ -8551,6 +8555,9 @@ imagemagick_load_image (struct frame *f, struct image *img, double rotation; char hint_buffer[MaxTextExtent]; char *filename_hint = NULL; +#ifdef USE_CAIRO + void *data = NULL; +#endif /* Initialize the ImageMagick environment. */ static bool imagemagick_initialized; @@ -8759,6 +8766,12 @@ imagemagick_load_image (struct frame *f, struct image *img, /* Magicexportimage is normally faster than pixelpushing. This method is also well tested. Some aspects of this method are ad-hoc and needs to be more researched. */ + void *dataptr; +#ifdef USE_CAIRO + data = xmalloc (width * height * 4); + const char *exportdepth = "BGRA"; + dataptr = data; +#else int imagedepth = 24; /*MagickGetImageDepth(image_wand);*/ const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP"; /*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ @@ -8771,6 +8784,8 @@ imagemagick_load_image (struct frame *f, struct image *img, image_error ("Imagemagick X bitmap allocation failure"); goto imagemagick_error; } + dataptr = ximg->data; +#endif /* not USE_CAIRO */ /* Oddly, the below code doesn't seem to work:*/ /* switch(ximg->bitmap_unit){ */ @@ -8793,14 +8808,17 @@ imagemagick_load_image (struct frame *f, struct image *img, */ int pixelwidth = CharPixel; /*??? TODO figure out*/ MagickExportImagePixels (image_wand, 0, 0, width, height, - exportdepth, pixelwidth, ximg->data); + exportdepth, pixelwidth, dataptr); } else #endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */ { size_t image_height; MagickRealType color_scale = 65535.0 / QuantumRange; - +#ifdef USE_CAIRO + data = xmalloc (width * height * 4); + color_scale /= 256; +#else /* Try to create a x pixmap to hold the imagemagick pixmap. */ if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) @@ -8811,6 +8829,7 @@ imagemagick_load_image (struct frame *f, struct image *img, image_error ("Imagemagick X bitmap allocation failure"); goto imagemagick_error; } +#endif /* Copy imagemagick image to x with primitive yet robust pixel pusher loop. This has been tested a lot with many different @@ -8823,7 +8842,9 @@ imagemagick_load_image (struct frame *f, struct image *img, #ifdef COLOR_TABLE_SUPPORT free_color_table (); #endif +#ifndef USE_CAIRO x_destroy_x_image (ximg); +#endif image_error ("Imagemagick pixel iterator creation failed"); goto imagemagick_error; } @@ -8839,16 +8860,27 @@ imagemagick_load_image (struct frame *f, struct image *img, for (x = 0; x < xlim; x++) { PixelGetMagickColor (pixels[x], &pixel); +#ifdef USE_CAIRO + ((uint32_t *)data)[width * y + x] = + lookup_rgb_color (f, + color_scale * pixel.red, + color_scale * pixel.green, + color_scale * pixel.blue); +#else XPutPixel (ximg, x, y, lookup_rgb_color (f, color_scale * pixel.red, color_scale * pixel.green, color_scale * pixel.blue)); +#endif } } DestroyPixelIterator (iterator); } +#ifdef USE_CAIRO + create_cairo_image_surface (img, data, width, height); +#else #ifdef COLOR_TABLE_SUPPORT /* Remember colors allocated for this image. */ img->colors = colors_in_color_table (&img->ncolors); @@ -8860,6 +8892,7 @@ imagemagick_load_image (struct frame *f, struct image *img, /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); +#endif /* Final cleanup. image_wand should be the only resource left. */ DestroyMagickWand (image_wand); -- 2.17.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 05 05:35:17 2018 Received: (at 31288-done) by debbugs.gnu.org; 5 May 2018 09:35:17 +0000 Received: from localhost ([127.0.0.1]:50235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fEtb3-0000Q1-C7 for submit@debbugs.gnu.org; Sat, 05 May 2018 05:35:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fEtb1-0000Pp-Uh for 31288-done@debbugs.gnu.org; Sat, 05 May 2018 05:35:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEtas-0000WU-NL for 31288-done@debbugs.gnu.org; Sat, 05 May 2018 05:35:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEtas-0000WA-K1; Sat, 05 May 2018 05:35:06 -0400 Received: from [176.228.60.248] (port=3076 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fEtar-0005hu-B7; Sat, 05 May 2018 05:35:05 -0400 Date: Sat, 05 May 2018 12:35:04 +0300 Message-Id: <83in82sawn.fsf@gnu.org> From: Eli Zaretskii To: Ari Roponen In-reply-to: <87h8nv23aj.fsf@gmail.com> (message from Ari Roponen on Sat, 28 Apr 2018 10:33:40 +0300) Subject: Re: [PATCH v2] Make cairo build usable References: <87h8nv23aj.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31288-done Cc: 31288-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Ari Roponen > Cc: Eli Zaretskii > Date: Sat, 28 Apr 2018 10:33:40 +0300 > > attached are new versions of patches. This time, the cairo support for > imagemagick is better integrated into existing code. Thanks, pushed to the master branch. From debbugs-submit-bounces@debbugs.gnu.org Sun May 06 08:37:05 2018 Received: (at 31288-done) by debbugs.gnu.org; 6 May 2018 12:37:05 +0000 Received: from localhost ([127.0.0.1]:51059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFIuX-0003el-Ir for submit@debbugs.gnu.org; Sun, 06 May 2018 08:37:05 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:40096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFIuV-0003eH-RO for 31288-done@debbugs.gnu.org; Sun, 06 May 2018 08:37:04 -0400 Received: by mail-lf0-f50.google.com with SMTP id p85-v6so1402797lfg.7 for <31288-done@debbugs.gnu.org>; Sun, 06 May 2018 05:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=dExg3TB31KLoPD/hnNkWHCr6FK1a5Sdfxl7MyUjrSJo=; b=gsNe+mFLG92RWqbn4ouA5vlr5cIGRvgD1xf+5JRHjw5vGzcIawPiAkgRpd2SI/1l7M acdpBOboJyUToj0SikyfRSfjcNQNYe6VflaxqDArdGH9zVxxSHAzIReFLTrpfDMw1/c2 YLZp9wYPNuwfrDzEsPv/vl4iHxzWoAUCogb9FtRfrCb50Q0hAyPGePalsCb69/bXxZW7 QSkAzXA6V9CNBbUVzW41lyHWnnZRCpo0dCHlTCiJu6nwpHiLaLK3tsVFaku5hmIjT6hw Soulq40p+UwTYvCp6z8fCCv7YNjwHowDpeL4P/LTHlYpRBZmw6LOMhK7kywUJTl/M3tH aupA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=dExg3TB31KLoPD/hnNkWHCr6FK1a5Sdfxl7MyUjrSJo=; b=gOUp4nGHNTPxD5TN0lavaQPmY2oGTaVANiAaoD0AHUBpG3R6vDEEYRA/FrqLLJj8uX El28C7kNFaKk/M2LCJmd4GQML7qb699YrHjBRh0ViXQjkMvRYOZMk4uVxQg1bBI8wslq eG8dX+WQbYgD/zaR2iRbpWlWBq9iboCe0rAcsVZPtMCt4Cp/4Ig7OsrAbDkguZUIlFk+ BGzpojamhZoOTk00OHR55zbSqMmckx1mN3g6A+jnf05bCBFNN3P/nvzluwdh8RtOhl3j Z+IrRrmwEDrVz4EsDxM9PmwmQuXRlfB7PgYhhC/VENo8eQQTqrrNWQ3mqlA1CrLrrSoU TnwQ== X-Gm-Message-State: ALKqPwdxniHEy9JsMqT33Kr8g4ogKKbGnZpZMDBzYZP9zF/34/UI11J7 iIPIMWbkdfYoJBo16Zii6skPZgs= X-Google-Smtp-Source: AB8JxZrisyUmWR38w5rZmR2/gk7/whBNvy4OG+nZqylAHuuyzinnbgxLp+62lBR3MUv4jQQOZoKAGQ== X-Received: by 2002:a2e:650a:: with SMTP id z10-v6mr3565718ljb.41.1525610217421; Sun, 06 May 2018 05:36:57 -0700 (PDT) Received: from arirop ([2001:2003:f7af:fd00:6103:b50a:7868:afe1]) by smtp.gmail.com with ESMTPSA id m18-v6sm4388418lfj.34.2018.05.06.05.36.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 06 May 2018 05:36:56 -0700 (PDT) From: Ari Roponen To: Eli Zaretskii Subject: Re: [PATCH v2] Make cairo build usable References: <87h8nv23aj.fsf@gmail.com> <83in82sawn.fsf@gnu.org> Date: Sun, 06 May 2018 15:36:55 +0300 In-Reply-To: <83in82sawn.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 May 2018 12:35:04 +0300") Message-ID: <87a7td6jvc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31288-done Cc: 31288-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-cairo-scrolling-for-side-by-side-windows.patch >From 788f0fc62881152b03043057fe98178d77a6bb3a Mon Sep 17 00:00:00 2001 From: Ari Roponen 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun May 06 14:29:48 2018 Received: (at 31288) by debbugs.gnu.org; 6 May 2018 18:29:48 +0000 Received: from localhost ([127.0.0.1]:51631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFOPs-0002qJ-Jj for submit@debbugs.gnu.org; Sun, 06 May 2018 14:29:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFOPp-0002q5-NO for 31288@debbugs.gnu.org; Sun, 06 May 2018 14:29:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFOPh-0001zj-I8 for 31288@debbugs.gnu.org; Sun, 06 May 2018 14:29:40 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFOPh-0001zX-EC; Sun, 06 May 2018 14:29:37 -0400 Received: from [176.228.60.248] (port=1430 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fFOPg-0001No-17; Sun, 06 May 2018 14:29:37 -0400 Date: Sun, 06 May 2018 21:29:37 +0300 Message-Id: <83wowgr626.fsf@gnu.org> From: Eli Zaretskii To: Ari Roponen In-reply-to: <87a7td6jvc.fsf@gmail.com> (message from Ari Roponen on Sun, 06 May 2018 15:36:55 +0300) Subject: Re: [PATCH v2] Make cairo build usable References: <87h8nv23aj.fsf@gmail.com> <83in82sawn.fsf@gnu.org> <87a7td6jvc.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31288 Cc: 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Ari Roponen > Cc: 31288-done@debbugs.gnu.org > Date: Sun, 06 May 2018 15:36:55 +0300 > > Eli Zaretskii 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. Thanks, pushed. Please in the future always mention the bug number in the commit message, otherwise I need top "git commit --amend" after "git am", to fix the commit message. From unknown Mon Aug 18 11:32:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 04 Jun 2018 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 25 21:25:54 2019 Received: (at control) by debbugs.gnu.org; 26 Mar 2019 01:25:54 +0000 Received: from localhost ([127.0.0.1]:58833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8aqf-0008O8-My for submit@debbugs.gnu.org; Mon, 25 Mar 2019 21:25:54 -0400 Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:52325) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8aqc-0008Ns-OA; Mon, 25 Mar 2019 21:25:51 -0400 Received: from mathent.math.s.chiba-u.ac.jp (mathent [192.168.32.5]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 09F31F08FE; Tue, 26 Mar 2019 10:25:48 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) Date: Tue, 26 Mar 2019 10:25:48 +0900 Message-ID: From: YAMAMOTO Mitsuharu To: Ari Roponen Subject: Re: bug#31288: [PATCH v2] Make cairo build usable In-Reply-To: <87a7td6jvc.fsf@gmail.com> References: <87h8nv23aj.fsf@gmail.com> <83in82sawn.fsf@gnu.org> <87a7td6jvc.fsf@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: Faculty of Science, Chiba University MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: Eli Zaretskii , 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) unarchive 31288 reopen 31288 quit On Sun, 06 May 2018 21:36:55 +0900, Ari Roponen wrote: > [1 ] > Eli Zaretskii 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 ] > >From 788f0fc62881152b03043057fe98178d77a6bb3a Mon Sep 17 00:00:00 2001 > From: Ari Roponen > 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 mituharu@math.s.chiba-u.ac.jp 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); From unknown Mon Aug 18 11:32:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: Did not alter fixed versions and reopened. Date: Tue, 26 Mar 2019 01:26:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # Did not alter fixed versions and reopened. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 26 02:14:08 2019 Received: (at 31288) by debbugs.gnu.org; 26 Mar 2019 06:14:09 +0000 Received: from localhost ([127.0.0.1]:58962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8fLc-0000l5-GP for submit@debbugs.gnu.org; Tue, 26 Mar 2019 02:14:08 -0400 Received: from mail-lj1-f174.google.com ([209.85.208.174]:32854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8fLa-0000kG-Qq for 31288@debbugs.gnu.org; Tue, 26 Mar 2019 02:14:07 -0400 Received: by mail-lj1-f174.google.com with SMTP id f23so10035452ljc.0 for <31288@debbugs.gnu.org>; Mon, 25 Mar 2019 23:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=+3s4tjPWj1zoINaHAyCnIHQFUbAtExtCJ7KZSMdyysQ=; b=GgpmGzqBrZc1k4n1NT4RrNbhYrp5SqmgnYm7W1KjC1oTAMsKrIeMqPgGuRrmGj5O1w TZJTJ2iNNGiexpt4m6tn73G+MmQwlIB2bH74VhOYX0M+L7UEJy9ZRkuyaXkD39+CdMkP mhgYB3/bJBp7i9rX6IAgHkQFKjb9LUSgXs9B3guL8jLl4Ur3Edcn3AC7Nfdfk/wHGyXy zS4ub9HNuyR2OUqtZ3C96NgzZqxcZu6tyKNknYlY1DNsnKDKNdsyjhVCiRZSoxPUKfzt EW81gBmkQoAivE8EUEoWqDdobEPOTqf/VerdS7uKeA36aG7XYq20pXeWI903npVyEaUa P+wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=+3s4tjPWj1zoINaHAyCnIHQFUbAtExtCJ7KZSMdyysQ=; b=qV6XVRCpUrFZIXFb5kCWko3cfZdU6Zpot0mAsZR+AAzM857G+twT5Fr+qpIjbx8ioY Xv9oUUojTmzcgGaPcjLJVoVTm2VC1QacjfrtYePuJnnbvPM5EDO70ZmFH2A/h39tOuEC 0r1rE+OqSfB4MgTc1zsj0xtIIh48Iw1Cyixpd5GRPDRiSgZ5aVVklYtnpGROsqpJ0LmH c1Z4DeacyScgnyFtF+nmppe27Vnk36Gn2PwxvU2CNfk6BAUR9CHSSamxu2RB9L7ir7nl fvZUO/gQdZjWgI2cgmN3yn82rRPveeAja8MoJW10oKKgaGF0kTWNDwvsy+9HnyD+vkZf xkSg== X-Gm-Message-State: APjAAAU7uhS07ZwObSaau7j3XzzWFdBjHfvrsGGlA36hEjOpOncDy6zq KH6uBb7bJvmlEbnsFCchM7/Qtcc= X-Google-Smtp-Source: APXvYqzd03sxwBizrrAywqe+DBXvyDI86b5y5QfQgjDCOXBziF/ICxtT0zak2njyHS8j6rDxmU6DPw== X-Received: by 2002:a2e:542:: with SMTP id 63mr15414556ljf.144.1553580840769; Mon, 25 Mar 2019 23:14:00 -0700 (PDT) Received: from arirop ([2001:2003:f7ce:f380:341a:e25f:d53f:902e]) by smtp.gmail.com with ESMTPSA id b19sm3730489lfi.96.2019.03.25.23.13.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 23:13:59 -0700 (PDT) From: Ari Roponen To: YAMAMOTO Mitsuharu Subject: Re: bug#31288: [PATCH v2] Make cairo build usable References: <87h8nv23aj.fsf@gmail.com> <83in82sawn.fsf@gnu.org> <87a7td6jvc.fsf@gmail.com> Date: Tue, 26 Mar 2019 08:13:58 +0200 In-Reply-To: (YAMAMOTO Mitsuharu's message of "Tue, 26 Mar 2019 10:25:48 +0900") Message-ID: <87o95y2me1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31288 Cc: Eli Zaretskii , 31288@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) YAMAMOTO Mitsuharu writes: > It causes display corruption when scroll bars are on the left. I > think the patch below will fix it. > > YAMAMOTO Mitsuharu > mituharu@math.s.chiba-u.ac.jp Yes, I can see the corruption too, and your patch fixes it. Thank you. From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 26 03:45:19 2019 Received: (at 31288-done) by debbugs.gnu.org; 26 Mar 2019 07:45:19 +0000 Received: from localhost ([127.0.0.1]:59008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8glr-00038G-5K for submit@debbugs.gnu.org; Tue, 26 Mar 2019 03:45:19 -0400 Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:51782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8glp-000388-D8 for 31288-done@debbugs.gnu.org; Tue, 26 Mar 2019 03:45:18 -0400 Received: from mathent.math.s.chiba-u.ac.jp (mathent [192.168.32.5]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id BEF18F08F9; Tue, 26 Mar 2019 16:45:15 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) Date: Tue, 26 Mar 2019 16:45:15 +0900 Message-ID: From: YAMAMOTO Mitsuharu To: Ari Roponen Subject: Re: bug#31288: [PATCH v2] Make cairo build usable In-Reply-To: <87o95y2me1.fsf@gmail.com> References: <87h8nv23aj.fsf@gmail.com> <83in82sawn.fsf@gnu.org> <87a7td6jvc.fsf@gmail.com> <87o95y2me1.fsf@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: Faculty of Science, Chiba University MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31288-done Cc: Eli Zaretskii , 31288-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, 26 Mar 2019 15:13:58 +0900, Ari Roponen wrote: > > YAMAMOTO Mitsuharu writes: > > > It causes display corruption when scroll bars are on the left. I > > think the patch below will fix it. > > > > YAMAMOTO Mitsuharu > > mituharu@math.s.chiba-u.ac.jp > > Yes, I can see the corruption too, and your patch fixes it. Thank you. Thanks for checking. I pushed the following to master. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp commit 9a6cba2bd397414c68217f4f5a9ea2888293ae1c Author: YAMAMOTO Mitsuharu Date: Tue Mar 26 16:39:07 2019 +0900 Fix cairo scrolling for left scroll bars case * src/xterm.c (x_scroll_run) [USE_CAIRO]: Fix scrolling by unusing WINDOW_LEFT_EDGE_X. (Bug#31288) From unknown Mon Aug 18 11:32:27 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 23 Apr 2019 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator