From: Ari Roponen <ari.roponen@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 31288@debbugs.gnu.org
Subject: bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable
Date: Fri, 27 Apr 2018 18:51:52 +0300 [thread overview]
Message-ID: <87r2n0ve93.fsf@gmail.com> (raw)
In-Reply-To: <83r2n0u29u.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 27 Apr 2018 17:55:57 +0300")
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
Eli Zaretskii <eliz@gnu.org> 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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-cairo-problems.patch --]
[-- Type: text/x-patch, Size: 4351 bytes --]
From d54819cb834fddce7488e8f6ebb392a53978b421 Mon Sep 17 00:00:00 2001
From: Ari Roponen <ari.roponen@gmail.com>
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
next prev parent reply other threads:[~2018-04-27 15:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 13:19 bug#31288: 27.0.50; [PATCH] Make cairo build somewhat usable Ari Roponen
2018-04-27 14:15 ` Eli Zaretskii
2018-04-27 14:35 ` Ari Roponen
2018-04-27 14:55 ` Eli Zaretskii
2018-04-27 15:51 ` Ari Roponen [this message]
2018-04-28 7:33 ` bug#31288: [PATCH v2] Make cairo build usable Ari Roponen
2018-05-05 9:35 ` Eli Zaretskii
2018-05-06 12:36 ` Ari Roponen
2018-05-06 18:29 ` Eli Zaretskii
[not found] ` <wltvfq1l5v.wl-mituharu@math.s.chiba-u.ac.jp>
2019-03-26 6:13 ` Ari Roponen
2019-03-26 7:45 ` YAMAMOTO Mitsuharu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2n0ve93.fsf@gmail.com \
--to=ari.roponen@gmail.com \
--cc=31288@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).