]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix display corruption with background alpha set on unsupported display
authorPo Lu <luangruo@yahoo.com>
Wed, 23 Feb 2022 05:13:19 +0000 (13:13 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 23 Feb 2022 05:14:28 +0000 (13:14 +0800)
* src/xfns.c (x_set_alpha_background): Make opaque if display
doesn't support the required features.

src/xfns.c

index 9afadd16e98250afe55bfcb10fda4236d3f871df..b2e3615fcf93124a721fc9a2580915f3daec2627 100644 (file)
@@ -737,6 +737,18 @@ x_set_alpha_background (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 
   gui_set_alpha_background (f, arg, oldval);
 
+#ifdef HAVE_XRENDER
+  /* Setting `alpha_background' to something other than opaque on a
+     display that doesn't support the required features leads to
+     confusing results.  */
+  if (f->alpha_background < 1.0
+      && !FRAME_DISPLAY_INFO (f)->alpha_bits
+      && !FRAME_CHECK_XR_VERSION (f, 0, 2))
+    f->alpha_background = 1.0;
+#else
+  f->alpha_background = 1.0;
+#endif
+
 #ifdef USE_GTK
   /* This prevents GTK from painting the window's background, which
      interferes with transparent background in some environments */