Work around window stacking problem

Yorick Hardy yh at metroweb.co.za
Tue Jun 24 12:13:12 CDT 2003


Work around the case when the sibling is specified, but the 
specified window is in fact not a sibling.

-- 
Yorick Hardy

--- dlls/x11drv/window.c	Sat Jun 21 12:33:17 2003
+++ dlls/x11drv/window.c	Tue Jun 24 14:59:12 2003
@@ -68,6 +68,14 @@
 static LPCSTR client_window_atom;
 static LPCSTR icon_window_atom;
 
+static int XWindowErrorHandler(Display *dpy, XErrorEvent *event, void *arg)
+{     
+    if (event->error_code == BadMatch)
+        return 1;
+    else
+        return 0;
+}
+
 /***********************************************************************
  *		is_window_managed
  *
@@ -585,7 +593,19 @@
             XReconfigureWMWindow( display, data->whole_window,
                                   DefaultScreen(display), mask, &changes );
         }
-        else XConfigureWindow( display, data->whole_window, mask, &changes );
+        else
+        {
+            X11DRV_expect_error( display, XWindowErrorHandler, NULL);
+            XConfigureWindow( display, data->whole_window, mask, &changes );
+            if (X11DRV_check_error())
+            {
+                WARN("XConfigureWindow: win %lx is not a sibling "
+                     "of window %lx, trying again.\n",
+                     changes.sibling, data->whole_window);
+                mask &= ~CWSibling;
+                XConfigureWindow( display, data->whole_window, mask, &changes );
+            }
+        }
         wine_tsx11_unlock();
     }
     return mask;



More information about the wine-patches mailing list