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>
This commit is contained in:
		
							parent
							
								
									71519a572f
								
							
						
					
					
						commit
						062f49a8e0
					
				| 
						 | 
				
			
			@ -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)
 | 
			
		||||
	{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue