[Xcb] About next release of xcb/util

Josh Triplett josh at joshtriplett.org
Thu Mar 25 08:43:28 PDT 2010

On Thu, Mar 25, 2010 at 08:50:07AM +0100, Julien Danjou wrote:
> Josh Triplett <josh at joshtriplett.org> writes:
> > http://lists.freedesktop.org/archives/xcb/2006-October/thread.html#2193
> > (thread "porting Xft and pango to XCB").
> Thanks.
> > 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.
> It seems like a really good idea. But does not that requires Xlib to be
> build with XCB support? Is that a standard nowadays?

Yes, it would require an Xlib built with XCB support, including the
libX11-xcb library that exposes that XCB support.

Back when we still had locking assertions that regularly triggered on
questionable code, some distros compiled --without-xcb to avoid the
pain.  However, with the new handoff-based implementation, all the
distros I've looked at build with XCB.

If any distros still build --without-xcb, we should figure out why and
try to address that.  Long-term, I'd like to try to phase out

Trying to support both Xlib and XCB in the same library without relying
on Xlib/XCB would necessarily require duplicate code paths, one using
XCB calls and one using Xlib calls; that seems like a losing plan.
Libraries like Cairo, designed to have many different backends with the
same frontend API, could manage such a design; however, even there the
pain of having two interfaces to X proves painful, and current Cairo has
a --with-xlib-xcb option that makes the Xlib backend call
XGetXCBConnection and use the XCB backend. :)

- Josh Triplett

More information about the Xcb mailing list