From ea953db0a06f1ca3e66fb2de6ec7500011d9b161 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 25 Jan 2022 10:14:28 +0800 Subject: [PATCH] Fix invalid picture after toggling the tool bar or menu bar on GTK * src/xterm.c (x_drop_xrender_surfaces): New function. (handle_one_xevent): Call x_drop_xrender_surfaces instead of just font_drop_xrender_surfaces. --- src/xterm.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index bf611db6bca..919c8b12ab2 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -358,6 +358,22 @@ x_flush (struct frame *f) unblock_input (); } +static void +x_drop_xrender_surfaces (struct frame *f) +{ + font_drop_xrender_surfaces (f); + +#ifdef HAVE_XRENDER + if (f && FRAME_X_DOUBLE_BUFFERED_P (f) + && FRAME_X_PICTURE (f) != None) + { + XRenderFreePicture (FRAME_X_DISPLAY (f), + FRAME_X_PICTURE (f)); + FRAME_X_PICTURE (f) = None; + } +#endif +} + #ifdef HAVE_XRENDER MAYBE_UNUSED static void x_xr_ensure_picture (struct frame *f) @@ -9061,7 +9077,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, } if (FRAME_X_DOUBLE_BUFFERED_P (f)) - font_drop_xrender_surfaces (f); + x_drop_xrender_surfaces (f); f->output_data.x->has_been_visible = true; SET_FRAME_GARBAGED (f); unblock_input (); @@ -9885,23 +9901,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, } f = x_top_window_to_frame (dpyinfo, configureEvent.xconfigure.window); - /* Unfortunately, we need to call font_drop_xrender_surfaces for + /* Unfortunately, we need to call x_drop_xrender_surfaces for _all_ ConfigureNotify events, otherwise we miss some and flicker. Don't try to optimize these calls by looking only for size changes: that's not sufficient. We miss some surface invalidations and flicker. */ block_input (); if (f && FRAME_X_DOUBLE_BUFFERED_P (f)) - font_drop_xrender_surfaces (f); -#ifdef HAVE_XRENDER - if (f && FRAME_X_DOUBLE_BUFFERED_P (f) - && FRAME_X_PICTURE (f) != None) - { - XRenderFreePicture (FRAME_X_DISPLAY (f), - FRAME_X_PICTURE (f)); - FRAME_X_PICTURE (f) = None; - } -#endif + x_drop_xrender_surfaces (f); unblock_input (); #if defined USE_CAIRO && !defined USE_GTK if (f) @@ -9931,7 +9938,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, block_input (); if (FRAME_X_DOUBLE_BUFFERED_P (f)) - font_drop_xrender_surfaces (f); + x_drop_xrender_surfaces (f); unblock_input (); xg_frame_resized (f, configureEvent.xconfigure.width, configureEvent.xconfigure.height); -- 2.39.5