From: Po Lu <luangruo@yahoo.com>
Date: Fri, 21 Jan 2022 05:22:51 +0000 (+0800)
Subject: Work around GTK changing window backgrounds on colormapped displays
X-Git-Tag: emacs-29.0.90~2883
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7fff3c9b7e44b5ce6e7a13d257613aeeb530fad1;p=emacs.git

Work around GTK changing window backgrounds on colormapped displays

* src/xterm.c (x_clear_window):
(x_clear_area): Fill the contents with the reverse GC instead of
using XClearArea and XClearWindow when not double buffered.
---

diff --git a/src/xterm.c b/src/xterm.c
index a53f2982c6b..1cbea12b3db 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1283,11 +1283,15 @@ x_clear_window (struct frame *f)
   cairo_paint (cr);
   x_end_cr_clip (f);
 #else
+#ifndef USE_GTK
   if (FRAME_X_DOUBLE_BUFFERED_P (f))
+#endif
     x_clear_area (f, 0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f));
+#ifndef USE_GTK
   else
     XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
 #endif
+#endif
 }
 
 #ifdef USE_CAIRO
@@ -4499,15 +4503,19 @@ x_clear_area (struct frame *f, int x, int y, int width, int height)
   cairo_fill (cr);
   x_end_cr_clip (f);
 #else
+#ifndef USE_GTK
   if (FRAME_X_DOUBLE_BUFFERED_P (f))
+#endif
     XFillRectangle (FRAME_X_DISPLAY (f),
 		    FRAME_X_DRAWABLE (f),
 		    f->output_data.x->reverse_gc,
 		    x, y, width, height);
+#ifndef USE_GTK
   else
     x_clear_area1 (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
                    x, y, width, height, False);
 #endif
+#endif
 }