[Xcb] About next release of xcb/util

Josh Triplett josh at joshtriplett.org
Wed Mar 24 12:30:51 PDT 2010


On Wed, Mar 24, 2010 at 09:45:00AM +0100, Julien Danjou wrote:
> Josh Triplett <josh at joshtriplett.org> writes:
> 
> > I seem to recall that someone ported Xft already, and the result got
> > dropped on the floor for silly reasons.  That needs fixing.
> 
> I'll try to look about that, but any link appreciated.

http://lists.freedesktop.org/archives/xcb/2006-October/thread.html#2193
(thread "porting Xft and pango to XCB").

IIRC, the thread turned up two issues.  First, that it ported an older
version of Pango; however, that shouldn't affect the Xft port.  Second,
that at the time we didn't have a clear notion of how to handle ports
without duplicating code between Xlib and XCB.

To solve the second issue in general, I'd like to propose a key strategy
for porting libraries like Xft from Xlib to XCB without duplication:
Start requiring Xlib/XCB for these ports, and depend on libX11-xcb.
Then, port the internals of the libraries to use XCB, and do nothing
with a Display except call XGetXCBConnection or pass the Display to
another library that uses Xlib.  If a library only does the former, then
ideally we can in the future pass an xcb_connection_t instead, and make
Xlib callers call XGetXCBConnection themselves.  This strategy will
avoid code duplication; it will also make it trivial to, someday, build
a version that doesn't bother supporting Xlib.

The main issue I see remaining with that plan: libraries which accept a
Display for every function call, rather than accepting a Display or
xcb_connection_t once and creating a library-specific object hiding it
like Cairo does.  We could of course make trivial compatibility wrapper
libraries which just forward to libfoo-xcb after calling
XGetXCBConnection; that seems tacky, but probably necessary for backward
compatibility.

Apart from that, we might run into issues with any library that assumes
Xlib's event handling rather than XCB's, given the all-or-nothing switch
required there.  Hopefully we don't run into too many libraries that do
event handling, apart from those which handle *all* events like toolkits
do.  For those libraries, we may have to have some code duplication so
that the library can work in either Xlib event mode or XCB event mode.

- Josh Triplett


More information about the Xcb mailing list