aboutsummaryrefslogtreecommitdiffstats
path: root/src/xftfont.c
diff options
context:
space:
mode:
authorPo Lu2022-05-03 09:22:06 +0800
committerPo Lu2022-05-03 09:22:06 +0800
commit952cc28e58eafbdd409bf36f9ca656dae533542b (patch)
treef51c18a73cff22d3b0b8294430b838cf59efbff6 /src/xftfont.c
parent64bcfcbd322d4fdb78c7d7dd0748dabc0e0b2cbc (diff)
downloademacs-952cc28e58eafbdd409bf36f9ca656dae533542b.tar.gz
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)
643 return 0; 643 return 0;
644} 644}
645 645
646/* When using X double buffering, the XftDraw structure we build 646/* When using X double buffering, the XRender surfaces we create seem
647 seems to be useless once a frame is resized, so recreate it on 647 to become useless once the window acting as the front buffer is
648 resized for an unknown reason (X server bug?), so recreate it on
648 ConfigureNotify and in some other cases. */ 649 ConfigureNotify and in some other cases. */
649 650
651#ifdef HAVE_XDBE
650static void 652static void
651xftfont_drop_xrender_surfaces (struct frame *f) 653xftfont_drop_xrender_surfaces (struct frame *f)
652{ 654{
653 block_input ();
654 if (FRAME_X_DOUBLE_BUFFERED_P (f)) 655 if (FRAME_X_DOUBLE_BUFFERED_P (f))
655 xftfont_end_for_frame (f); 656 {
656 unblock_input (); 657 block_input ();
658 xftfont_end_for_frame (f);
659 unblock_input ();
660 }
657} 661}
662#endif
658 663
659static bool 664static bool
660xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, 665xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object,
@@ -741,35 +746,37 @@ static void syms_of_xftfont_for_pdumper (void);
741struct font_driver const xftfont_driver = 746struct font_driver const xftfont_driver =
742 { 747 {
743 /* We can't draw a text without device dependent functions. */ 748 /* We can't draw a text without device dependent functions. */
744 .type = LISPSYM_INITIALLY (Qxft), 749 .type = LISPSYM_INITIALLY (Qxft),
745 .get_cache = xfont_get_cache, 750 .get_cache = xfont_get_cache,
746 .list = xftfont_list, 751 .list = xftfont_list,
747 .match = xftfont_match, 752 .match = xftfont_match,
748 .list_family = ftfont_list_family, 753 .list_family = ftfont_list_family,
749 .open_font = xftfont_open, 754 .open_font = xftfont_open,
750 .close_font = xftfont_close, 755 .close_font = xftfont_close,
751 .prepare_face = xftfont_prepare_face, 756 .prepare_face = xftfont_prepare_face,
752 .done_face = xftfont_done_face, 757 .done_face = xftfont_done_face,
753 .has_char = xftfont_has_char, 758 .has_char = xftfont_has_char,
754 .encode_char = xftfont_encode_char, 759 .encode_char = xftfont_encode_char,
755 .text_extents = xftfont_text_extents, 760 .text_extents = xftfont_text_extents,
756 .draw = xftfont_draw, 761 .draw = xftfont_draw,
757 .get_bitmap = ftfont_get_bitmap, 762 .get_bitmap = ftfont_get_bitmap,
758 .anchor_point = ftfont_anchor_point, 763 .anchor_point = ftfont_anchor_point,
759#ifdef HAVE_LIBOTF 764#ifdef HAVE_LIBOTF
760 .otf_capability = ftfont_otf_capability, 765 .otf_capability = ftfont_otf_capability,
761#endif 766#endif
762 .end_for_frame = xftfont_end_for_frame, 767 .end_for_frame = xftfont_end_for_frame,
763#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF 768#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
764 .shape = xftfont_shape, 769 .shape = xftfont_shape,
765#endif 770#endif
766#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX 771#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
767 .get_variation_glyphs = ftfont_variation_glyphs, 772 .get_variation_glyphs = ftfont_variation_glyphs,
773#endif
774 .filter_properties = ftfont_filter_properties,
775 .cached_font_ok = xftfont_cached_font_ok,
776 .combining_capability = ftfont_combining_capability,
777#ifdef HAVE_XDBE
778 .drop_xrender_surfaces = xftfont_drop_xrender_surfaces,
768#endif 779#endif
769 .filter_properties = ftfont_filter_properties,
770 .cached_font_ok = xftfont_cached_font_ok,
771 .combining_capability = ftfont_combining_capability,
772 .drop_xrender_surfaces = xftfont_drop_xrender_surfaces,
773 }; 780 };
774#ifdef HAVE_HARFBUZZ 781#ifdef HAVE_HARFBUZZ
775struct font_driver xfthbfont_driver; 782struct font_driver xfthbfont_driver;