[cairo] Interested in XCB (but not GSoC)

Carl Worth cworth at cworth.org
Tue Apr 1 12:53:03 PDT 2008


On Mon, 31 Mar 2008 15:53:50 +0200, Felix Rabe wrote:
> I recently found an interest to start programming a level below GTK+,
> i.e. with XCB, and would like to use Cairo for the drawing there.  I
> thought of XCB as being the "new cool thing" (compared to XLib) to write
> X clients, so I'm astonished to read on the GSoC ideas page that XCB is
> not maintained.

Hi Felix,

Welcome! I'm glad you're interested in cairo.

Yes, XCB is definitely the "new cool thing". Please don't
misunderstand the note on the cairo Summer of Code idea page. When we
say that cairo's XCB backend is "not maintained" we definitely don't
mean that the code has been abandoned, or is deemed uninteresting or
anything like that.

Instead, the current fact is that most people are still using the xlib
backend, (since cairo-using toolkits like GTK+ haven't switched to XCB
yet). Because of that, it's inside the cairo-xlib backend that bugs
are encountered and where things get fixed.

So then there's additional effort needed to make those bug fixes
happen to the cairo-xcb code, and that always lags, (particularly
since it's less common for people to actually be running that code and
encountering the bugs). And it is true that we are currently missing a
"cairo-xcb maintainer" to stay on top of these issues.

Finally, since the two backends are *very* similar, it's really only
sensible to share as much as code as possible so that the bug fixes
only have to happen in one place.

> - Does Cairo-XCB work at all?  (Not tested yet, will compile in the next
> days.)

It should, yes. Sometime ago, Jamey Sharp and I sat down and even made
sure the entire test suite passed. I think at the time, that Jamey
only knew of one potential problem in cairo-xcb---namely that if using
an X server and client with different endianness that it wouldn't
properly byteswap images. (That's something that we should add to the
list for proposed testing infrastructure.)

> - How were PS/PDF merged?  (Thomas or somebody, please post your Git
> commit hashes or mailing list findings to the mailing list.  I'll do
> likewise should I find something first.)

I don't think the commit history is interesting here. The point is
that you can look at cairo-pdf-surface.c and cairo-ps-surface.c and
then a shared file like cairo-pdf-operators.c which avoids code
duplication.

> - How do we merge XCB and XLib?

The easy thing to do is to sit down with both cairo-xlib-surface.c and
cairo-xcb-surface.c and notice how much of the code is structured
identically with only very minor differences. There are likely a few
major differences due to recent things that have been added to only
the xlib backend, (support for arbitrary TrueColor and PseudoColor
visuals comes to mind as an obvious recent example).

Then it's really just a matter of factoring out common code and
finding clever ways to share that while maintaining the necessary
differences. The details will differ from the PostScript/PDF sharing,
(where PostScript header code is actually emitted into the output file
to define new PostScript functions that are compatible with native PDF
operators). Instead what will be needed is preprocessor magic or
tables of function pointers or whatever to enable the common code to
properly call into Xlib or XCB functions as needed.

> - Who will maintain XCB and/or the merged XCB/Xlib backend?

The important point is that once things are merged, any of the current
cairo-xlib maintenance, (which has been working well), will
immediately benefit the cairo-xcb backend as well. So a "missing"
maintainer for cairo-xcb will no longer be a sever problem.

> Caveat: my X programming experience (in contrast to GTK+) is practically
> non-existing.

No problem. It turns out we all learn this stuff as we go along.

> Guys, let's innovate, it's about time.

Sounds great. I'm looking forward to your contributions,

Have fun with cairo!

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080401/0b129840/attachment.pgp 


More information about the cairo mailing list