Ren, Zhaohan wrote:
> Does anyone have a better way?
A less hacky (but slower and more bandwidth intensive) way would be to
call GetGeometry on the drawable. If x, y, or border-width are > 0, then
it's a window. Otherwise, take the root window in the reply and use it
to walk the entire tree using multiple calls to QueryTree[1]. If you
find the drawable ID in the tree, it's a window. Otherwise, it's a pixmap.
The *best* way (as Adam hinted) to determine if a drawable is a window
or a pixmap is to have two different entry points in your library:
PostProcessWindow and PostProcessPixmap (instead of
PostProcessDrawable). The application that calls your library will know
which one to use. This is the only method that requires zero round-trips
to the server.
Peter Harris
[1] xcb_query_tree will allow you to issue multiple requests at once,
saving round-trip delays compared to XQueryTree. But it will still be
somewhat slow.
--
Open Text Connectivity Solutions Group
Peter Harris http://www.opentext.com/connectivity
Research and Development Phone: +1 905 762 6001
[email protected] Toll Free: 1 877 359 4866
_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel