[xcb] Quick and dirty XCL
Jamey Sharp
xcb@nickle.org
Wed, 11 Sep 2002 04:52:03 -0700
So, I've been thinking.
Hypothesis: The only reason Xlib apps fail to run on XCL/Xlib
using the LD_PRELOAD method is because the Display structure
doesn't have a valid output buffer pointer, _XtransConnInfo
pointer, and last request sequence number.
If this is true, I should be able to layer anything that works
with Xlib on top of XCB instead by the following steps.
* Expose XCB's output queue. Change _X11TransWrite* to write
there instead of the real socket.
* Support a call-back from XCB that XCB will use to get the
next sequence number. Provide a default that uses the value
in the XCBConnection.
* Support a call-back from XCBAllocOut telling the client to
flush any output buffers into XCB. Hopefully this won't be
implemented to force XCB to flush too.
* Change XCB's "unexpected reply" handling. Optionally pass
those replies that have no reply record to a registered
call-back function, instead of discarding them.
* Replace XOpenDisplay with an implementation very much like
the one currently in XCL. Register with XCB handlers for
"unexpected reply", sequence number, and buffer flush.
* XCL's "unexpected reply" handler should buffer all the
packets given to it, in order to return them from calls to
_X11TransRead* and to have some basis for values from
_X11TransBytesReadable.
XOpenDisplay and _X11Trans* are all functions and so can be
replaced using LD_PRELOAD. I don't think any macros need to be
replaced under this scheme: in particular, GetReq and friends
should be fine.
There's my new plan for quick and dirty XCL. Note that it
doesn't supersede plans for complete XCL, but would give us
something to play with until somebody has time to figure out
the right thing. Have I missed anything important?
--
Jamey Sharp <jamey@sharp.ath.cx> - http://jamey.is.dreaming.org/