From 57b24366822f4828b4e9e5de4eefd19cb9cee518 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Mon, 24 May 2021 06:29:25 +0900 Subject: [PATCH] mwm: Ignore BadWindow errors 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 | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/mwm.c b/mwm.c index 1556e97..90c1556 100644 --- 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) -- 2.47.3