From: Po Lu Date: Wed, 23 Feb 2022 05:13:19 +0000 (+0800) Subject: Fix display corruption with background alpha set on unsupported display X-Git-Tag: emacs-29.0.90~2146 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e97580724ded250ffb17baf01d37b15325433dd9;p=emacs.git Fix display corruption with background alpha set on unsupported display * src/xfns.c (x_set_alpha_background): Make opaque if display doesn't support the required features. --- diff --git a/src/xfns.c b/src/xfns.c index 9afadd16e98..b2e3615fcf9 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -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 */