[Xquartz-dev] override-redirect problems

George Peter Staplin georgeps at xmission.com
Thu Oct 16 14:39:40 PDT 2008


Quoted Jeremy Huddleston <jeremyhu at apple.com>:

> I sent this message to the main xorg list, but thought I should pop it
> in here as well...
>
> --Jeremy
>
> ===
>
> We're having some difficulty with menus in some applications like
> nedit and xemacs.  I believe these menus are windows with override-
> redirect set on them per section 4.1.10 (popup windows) of ICCCM:
> http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.10
>
> """
> If the window will be visible for a very short time and should not be
> decorated at all, the client can set override-redirect on the window.
> In general, this should be done only if the pointer is grabbed while
> the window is mapped. The window manager will never interfere with
> these windows, which should be used with caution. An example of an
> appropriate use is a pop-up menu.
> """
>
> The problem is that windows following this route don't get handled by
> our WM and don't get their native windows parented properly by quartz-
> wm.  When a window sets WM_TRANSIENT_FOR, we set its native window as
> a child to its parent's native window so the menu "belongs to" and
> "moves with" the parent.  This works fine for nedit's Open dialog for
> example.  Menus that don't set WM_TRANSIENT_FOR and follow this
> override-redirect approach don't get parented properly and cause
> problems (like the menu appearing in the wrong Space [virtual desktop]
> because that's the Space it was last rendered in and thus the native
> window bound to).
>
> We need a way to bind the native window for this menu to the native
> window for its parent.  Currently it is just bound to the Space in
> which it is first rendered... so does anyone have some suggestions for
> the least invasive way to go about this?  Doing some quick
> investigation with xwininfo on the window, I see no wm hints, and it's
> parent window id is the root window... so... yick.
>
> Any thoughts?

I have an ugly idea to fix this.  The XIDs are not random that are  
used for Windows.  The application has a base XID, and it allocates  
Windows with a certain pattern.  So there should be a common prefix  
for the XIDs allocated for a client.  This prefix varies depending on  
how many clients the X server supports IIRC (MAXCLIENTS), which seems  
to be 256 for XQuartz.  See: xserver/dix/resource.c

RESOURCE_CLIENT_BITS is also involved.  See: xserver/include/resource.h

I added an optional feature to my window manager (Whim) that would  
arrange related windows with a group.  I think you might be able to  
find the parent based on the common prefix, such as 0x8000 or  
something similar.  It's a hack, but I don't know of a better way.

There is also an X AppGroup extension in Xext, but I don't think it's  
specifically designed for such purposes.  I may be mistaken though.   
You might be able to use it.  Look for Xag*().


George
-- 
http://people.freedesktop.org/~gstaplin/


More information about the Xquartz-dev mailing list