[Xcb] [PATCH:xwininfo] Convert from Xlib to xcb

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jun 14 08:16:47 PDT 2010


Vincent Torri wrote:
> imho, you can improve it a bit more by making Window_Has_Property() and
> Window_Is_Viewable() async (in clientwin.c). If the number of children
> is high, maybe it can speed it up.

Yeah, I didn't spend much time on clientwin.c since I hadn't figured out how
to test it yet, so did the straightforward conversion there.

Some other things I probably should have mentioned:

 - If you run xwininfo with the argument "-name foo" it starts at root and
   crawls down the tree looking at every window's name until it finds one
   named "foo" (via Window_With_Name() in dsimple.c) - in making this code
   asynchronous it will over-prefetch.   At each node in the tree that it
   visits, it calls xcb_get_wm_name & xcb_query_tree up front for all the
   children, and then goes through the results.   If it finds a match it
   then calls xcb_discard_reply for the rest of the cookies.   This trades
   the latency of the many waits for round trips in the Xlib version for a
   bit of extra bandwidth and some number of requests that are likely to be
   discarded in the end.   (They could be cached for later use if you called
   xwininfo with the -tree argument, but that is a bigger redesign than I
   was going for at this point, and I rarely use the -name argument anyway.)

 - xproto is still required for the Xfuncproto.h header (defines the
   compiler-portability macros like __X_NORETURN, _X_PRINTF, etc.)

 - xlib headers are still required for the cursorfont.h header to get
   the XC_crosshairs cursor used when you don't specify any window and
   it tells you to click on one (hence the thread I started last week).

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the Xcb mailing list