summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2009-11-04 17:36:54 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2009-11-09 20:33:36 +0000
commit062f49a8e0d1afb4dd32e9451a47ab2792639e7f (patch)
tree604a658e33610c47d3f21d125bfb656b5944797b
parent71519a572fe15b85c0eb2b02636c9e871f2c858f (diff)
Cygwin/X: Add a workaround for a SWT/Motif bug to internal window manager
SWT/Motif expects all top-level windows to get reparented, and waits until they do. So workaround that in our internal WM by forcing a reparent event to occur, even though we don't actually need to reparent the window to frame it (as the frame is a native window, not an X window) http://sourceware.org/bugzilla/show_bug.cgi?id=9848 https://bugs.eclipse.org/bugs/show_bug.cgi?id=36806 Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
-rw-r--r--hw/xwin/winmultiwindowwm.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index d7f13c7ef..8fb80f45a 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1061,6 +1061,60 @@ winMultiWindowXMsgProc (void *pArg)
event.xcreatewindow.window,
0);
}
+ else if (event.type == MapNotify)
+ {
+ /* Fake a reparentNotify event as SWT/Motif expects a
+ Window Manager to reparent a top-level window when
+ it is mapped and waits until they do.
+
+ We don't actually need to reparent, as the frame is
+ a native window, not an X window
+
+ We do this on MapNotify, not MapRequest like a real
+ Window Manager would, so we don't have do get involved
+ in actually mapping the window via it's (non-existent)
+ parent...
+
+ See sourceware bugzilla #9848
+ */
+
+ XWindowAttributes attr;
+ Window root;
+ Window parent;
+ Window *children;
+ unsigned int nchildren;
+
+ if (XGetWindowAttributes(event.xmap.display,
+ event.xmap.window,
+ &attr) &&
+ XQueryTree(event.xmap.display,
+ event.xmap.window,
+ &root, &parent, &children, &nchildren))
+ {
+ if (children) XFree(children);
+
+ /*
+ It's a top-level window if the parent window is a root window
+ Only non-override_redirect windows can get reparented
+ */
+ if ((attr.root == parent) && !event.xmap.override_redirect)
+ {
+ XEvent event_send;
+
+ event_send.type = ReparentNotify;
+ event_send.xreparent.event = event.xmap.window;
+ event_send.xreparent.window = event.xmap.window;
+ event_send.xreparent.parent = parent;
+ event_send.xreparent.x = attr.x;
+ event_send.xreparent.y = attr.y;
+
+ XSendEvent(event.xmap.display,
+ event.xmap.window,
+ True, StructureNotifyMask,
+ &event_send);
+ }
+ }
+ }
else if (event.type == PropertyNotify
&& event.xproperty.atom == atmWmName)
{