From 58f6cbeb58c2394f6360e97d1a6e49c1c1df3166 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 10 May 2022 14:38:22 +0800 Subject: [PATCH] Work around some broken programs when reading opacity prop * src/xterm.c (handle_one_xevent): Accept some other types that property is set to by thoughtless programs. --- src/xterm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index de3129fd87c..5818eb1d02e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -14861,11 +14861,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, { rc = XGetWindowProperty (dpyinfo->display, FRAME_OUTER_WINDOW (f), dpyinfo->Xatom_net_wm_window_opacity, - 0, 1, False, XA_CARDINAL, &actual, + 0, 1, False, AnyPropertyType, &actual, &actual_format, &n, &left, &tmp_data); if (rc == Success && actual_format == 32 - && actual == XA_CARDINAL && n) + && (actual == XA_CARDINAL + /* Some broken programs set the opacity property + to those types, but window managers accept + them anyway. */ + || actual == XA_ATOM + || actual == XA_WINDOW) && n) { opacity = *(unsigned long *) tmp_data & OPAQUE; f->alpha[0] = (double) opacity / (double) OPAQUE; -- 2.39.2