]> git.corax.cc Git - mwm/commitdiff
mwm: Ignore BadWindow errors
authorMatthias Kruk <m@m10k.eu>
Sun, 23 May 2021 21:29:25 +0000 (06:29 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 23 May 2021 21:29:25 +0000 (06:29 +0900)
There are windows that cannot be reconfigured when running on Xorg
with xdm (I'm not sure about other configurations, but at least this
does not affect Xephyr). Avoid the problem by ignoring BadWindow
errors until a proper solution is found.

mwm.c

diff --git a/mwm.c b/mwm.c
index 1556e97f5a6bf708fca74716c6d3683b32c71900..90c15565d443e1ba675087072456cd26dac55186 100644 (file)
--- a/mwm.c
+++ b/mwm.c
@@ -924,29 +924,33 @@ static int _xerror_nop(Display *display, XErrorEvent *event)
 
 static int _can_ignore_error(XErrorEvent *event)
 {
-        static struct {
-                unsigned char error_code;
-                unsigned char request_code;
-        } ignore_ok[] = {
-                { BadMatch, X_SetInputFocus },
-                { BadDrawable, X_PolyText8 },
-                { BadDrawable, X_PolyFillRectangle },
-                { BadDrawable, X_PolySegment },
-                { BadMatch, X_ConfigureWindow },
-                { BadAccess, X_GrabButton },
-                { BadAccess, X_GrabKey },
-                { BadDrawable, X_CopyArea }
-        };
-        int i;
-
-        for(i = 0; i < (sizeof(ignore_ok) / sizeof(ignore_ok[0])); i++) {
-                if(event->request_code == ignore_ok[i].request_code &&
-                   event->error_code == ignore_ok[i].error_code) {
-                        return(1);
-                }
-        }
+       static struct {
+               unsigned char error_code;
+               unsigned char request_code;
+       } ignore_ok[] = {
+               { BadMatch, X_SetInputFocus },
+               { BadDrawable, X_PolyText8 },
+               { BadDrawable, X_PolyFillRectangle },
+               { BadDrawable, X_PolySegment },
+               { BadMatch, X_ConfigureWindow },
+               { BadAccess, X_GrabButton },
+               { BadAccess, X_GrabKey },
+               { BadDrawable, X_CopyArea }
+       };
+       int i;
+
+       if(event->error_code == BadWindow) {
+               return(1);
+       }
 
-        return(0);
+       for(i = 0; i < (sizeof(ignore_ok) / sizeof(ignore_ok[0])); i++) {
+               if(event->request_code == ignore_ok[i].request_code &&
+                  event->error_code == ignore_ok[i].error_code) {
+                       return(1);
+               }
+       }
+
+       return(0);
 }
 
 static int _xerror_handle(Display *display, XErrorEvent *event)