REQ: X11 programming help
REQ: X11 programming help
- Subject: REQ: X11 programming help
- From: Matthew Klahn <email@hidden>
- Date: Mon, 19 Jan 2004 19:08:39 -0600
Hello, all. This isn't really anything that has specifically to do with
X11.app, but is rather a question about X Window programming and, in
particular, XFree86's implementation on a particular problem I'm having
with X11 support in CodeTek VirtualDesktop.
I am trying to determine how to identify accurately and precisely
pop-up windows like those that are used for tooltips and menus in
applications like Emacs and Xman. After trying some of the things that
appeared should work, since they are documented to be for the purpose
specified, I am having a hard time identifying reliable mechanisms.
First, let me tell you what I have tried, and what I have found to
work, but don't wish to rely upon.
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.