Re: REQ: X11 programming help
Re: REQ: X11 programming help
- Subject: Re: REQ: X11 programming help
- From: John Harper <email@hidden>
- Date: Mon, 19 Jan 2004 21:09:34 -0800
Hi,
The main thing you're missing is that any window managed by a window
manager will be reparented away from the root window, and into a window
created by the wm that is a child of the root. Presumably you're
iterating over all children of the root window, in which case you'll
only see the windows created by the window manager (and any windows
that it decided not to manage)
All of the attributes or properties you mention below will be set on
the original window. The way to find that window for a given child of
the root is to recurse down the subtree until you find a window with
the WM_STATE property set on it -- that's the original window, and
where you can check for WM_TRANSIENT_FOR etc
Once you find the actual client window, checking for either
WM_TRANSIENT_FOR or override_redirect should get you most popup
windows. It may also be worth checking the _NET_WM_WINDOW_TYPE property
(see
http://freedesktop.org/Standards/wm-spec/1.3/ar01s05.html#id2767898)
John
On Jan 19, 2004, at 5:08 PM, Matthew Klahn wrote:
First, I thought that override-redirect would work, since the Xlib
documentation has this to say about that flag:
<quote>
3.2.8. Override Redirect Flag To control windowplacement or to add
decoration, a windowmanager often needs to intercept (redirect) anymap
or configure request. Pop-up windows, however, often need to be mapped
without a windowmanager getting in the way. Tocontrol whether
anInputOutput or InputOnlywindowistoignore these structure control
facilities, use the override-redirect flag. The override-redirect flag
specifies whether map and configure requests on this windowshould
override aSubstructureRedirectMaskon the parent. Youcan set the
override-redirect flag to Trueor False(default). Windowmanagers use
this information to avoid tampering with pop-up windows (see also
chapter 14).
</quote>
This would seem to imply that all pop-up windows should have
override-redirect set to 'True'. However, experience shows that every
window managed by X11.app (and perhaps XFree86 in general) has
override-redirect set to 'True'.
Second, I thought that pop-up windows might be children of the parent
window whose control caused the new window to be created. However, it
appears that all windows have the root window as their parent, and not
the other parent window of the application.
Third, I thought that perhaps there would be some mechanism to
identify pop-up windows directly. I therefore found the
WM_TRANSIENT_FOR property, described in the Xlib documentation as:
"Set by application programs to indicate to the windowmanager that a
transient top-levelwindow, such as a dialog box." However,
XGetTransientForHint always returns 0 and with a 0 value for all the
windows in question, indicating failure.
I haven't found any other brilliant ways of telling whether a window
is some form of pop-up, save the two I will discuss below. There are
certain visual things that make it apparent that there MUST be a way
to do this, namely that they don't have titlebars drawn by X11.app.
I did notice that all of the window ids start with 0x800000 and have a
range of 0x800000-0x8fffff. All of the tooltip/menu windows that I
have observed start at 0xc00000 and higher (some start at 0x1200000,
actually). I believe that this is is governed by the resource-id-mask
properties, but I cannot find in the X Protocol specifications any
rhyme or reason to this, and I don't wish to rely completely on one
implementation of X11R6. If there is a way to decode the resource ID
of a window into some form of classification scheme like this, I would
be grateful if someone would point that out.
I also notice that the "save-under" flag is set for every one of the
windows that I wish to include and has not (yet) been set on a window
that I wish to ignore. However, this appears to be shaky at best,
because I am relying upon the application writers to "do the right
thing", and am not relying on the server itself to tell me what kind
of window I'm dealing with. However, if NOT setting the save-under
flag would be disastrous for pop-up windows and likewise setting it
would be disastrous for normal windows (thus making it something that
only the most inexperienced X programmer would do), I'd be willing to
consider using it for now.
If anyone has any idea about how I could gather this information, I
would be very grateful for the help.
--
Matthew S. Klahn
Software Architect, CodeTek Studios, Inc.
http://www.codetek.com
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback:
http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.