summaryrefslogtreecommitdiff
path: root/src/xftfont.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-05-03 09:22:06 +0800
committerPo Lu <luangruo@yahoo.com>2022-05-03 09:22:06 +0800
commit952cc28e58eafbdd409bf36f9ca656dae533542b (patch)
treef51c18a73cff22d3b0b8294430b838cf59efbff6 /src/xftfont.c
parent64bcfcbd322d4fdb78c7d7dd0748dabc0e0b2cbc (diff)
downloademacs-952cc28e58eafbdd409bf36f9ca656dae533542b.tar.gz
emacs-952cc28e58eafbdd409bf36f9ca656dae533542b.tar.bz2
emacs-952cc28e58eafbdd409bf36f9ca656dae533542b.zip
Clean up X11 double buffering code
This fixes several latent bugs where code went down the path with double buffering enabled when it wasn't, and vice versa. * src/xfns.c (x_set_inhibit_double_buffering): Improve commentary and only define when HAVE_XDBE. (x_mark_frame_dirty): Only set buffer flip flag when HAVE_XDBE. (initial_set_up_x_back_buffer): Clean up coding style and remove unnecessary block_input pair. (Fx_double_buffered_p): Always return nil if !HAVE_XDBE. (x_frame_parm_handlers): Don't set double buffering handler if !HAVE_XDBE. * src/xftfont.c (xftfont_drop_xrender_surfaces, xftfont_driver): Only define when XDBE is available. * src/xterm.c (x_drop_xrender_surfaces): Likewise. (x_clear_window): Don't test double buffering flags when !HAVE_XDBE. (show_back_buffer): Only define when HAVE_XDBE. (x_flip_and_flush): Don't try to flip when !HAVE_XDBE. (XTframe_up_to_date): Likewise. (XTbuffer_flipping_unblocked_hook): Only define when Xdbe is available. (x_clear_area): Don't test double buffering flags when Xdbe is not available. (flush_dirty_back_buffer_on): Don't define if there's no DBE. (handle_one_xevent, x_create_terminal): Likewise. * src/xterm.h (FRAME_X_DRAWABLE): Fix coding style.
Diffstat (limited to 'src/xftfont.c')
-rw-r--r--src/xftfont.c63
1 files changed, 35 insertions, 28 deletions
diff --git a/src/xftfont.c b/src/xftfont.c
index e27c6cf3146..31fb877c35b 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -643,18 +643,23 @@ xftfont_end_for_frame (struct frame *f)
return 0;
}
-/* When using X double buffering, the XftDraw structure we build
- seems to be useless once a frame is resized, so recreate it on
+/* When using X double buffering, the XRender surfaces we create seem
+ to become useless once the window acting as the front buffer is
+ resized for an unknown reason (X server bug?), so recreate it on
ConfigureNotify and in some other cases. */
+#ifdef HAVE_XDBE
static void
xftfont_drop_xrender_surfaces (struct frame *f)
{
- block_input ();
if (FRAME_X_DOUBLE_BUFFERED_P (f))
- xftfont_end_for_frame (f);
- unblock_input ();
+ {
+ block_input ();
+ xftfont_end_for_frame (f);
+ unblock_input ();
+ }
}
+#endif
static bool
xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object,
@@ -741,35 +746,37 @@ static void syms_of_xftfont_for_pdumper (void);
struct font_driver const xftfont_driver =
{
/* We can't draw a text without device dependent functions. */
- .type = LISPSYM_INITIALLY (Qxft),
- .get_cache = xfont_get_cache,
- .list = xftfont_list,
- .match = xftfont_match,
- .list_family = ftfont_list_family,
- .open_font = xftfont_open,
- .close_font = xftfont_close,
- .prepare_face = xftfont_prepare_face,
- .done_face = xftfont_done_face,
- .has_char = xftfont_has_char,
- .encode_char = xftfont_encode_char,
- .text_extents = xftfont_text_extents,
- .draw = xftfont_draw,
- .get_bitmap = ftfont_get_bitmap,
- .anchor_point = ftfont_anchor_point,
+ .type = LISPSYM_INITIALLY (Qxft),
+ .get_cache = xfont_get_cache,
+ .list = xftfont_list,
+ .match = xftfont_match,
+ .list_family = ftfont_list_family,
+ .open_font = xftfont_open,
+ .close_font = xftfont_close,
+ .prepare_face = xftfont_prepare_face,
+ .done_face = xftfont_done_face,
+ .has_char = xftfont_has_char,
+ .encode_char = xftfont_encode_char,
+ .text_extents = xftfont_text_extents,
+ .draw = xftfont_draw,
+ .get_bitmap = ftfont_get_bitmap,
+ .anchor_point = ftfont_anchor_point,
#ifdef HAVE_LIBOTF
- .otf_capability = ftfont_otf_capability,
+ .otf_capability = ftfont_otf_capability,
#endif
- .end_for_frame = xftfont_end_for_frame,
+ .end_for_frame = xftfont_end_for_frame,
#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
- .shape = xftfont_shape,
+ .shape = xftfont_shape,
#endif
#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
- .get_variation_glyphs = ftfont_variation_glyphs,
+ .get_variation_glyphs = ftfont_variation_glyphs,
+#endif
+ .filter_properties = ftfont_filter_properties,
+ .cached_font_ok = xftfont_cached_font_ok,
+ .combining_capability = ftfont_combining_capability,
+#ifdef HAVE_XDBE
+ .drop_xrender_surfaces = xftfont_drop_xrender_surfaces,
#endif
- .filter_properties = ftfont_filter_properties,
- .cached_font_ok = xftfont_cached_font_ok,
- .combining_capability = ftfont_combining_capability,
- .drop_xrender_surfaces = xftfont_drop_xrender_surfaces,
};
#ifdef HAVE_HARFBUZZ
struct font_driver xfthbfont_driver;