[Xcb] about translation of Xlib functions

Jamey Sharp jamey at minilop.net
Sat Dec 10 16:22:34 PST 2005


On Fri, Dec 09, 2005 at 11:13:31PM +0100, Vincent Torri wrote:
> now, another version :

Gah, you write faster than I read/review apparently. ;-)

> I have re-orgnized a bit the way the macros are listed. I think that's
> it's a bit better.

Yeah, it looks great! A couple of notes:

For ServerVendor, Xlib returns a null-terminated string, but XCB doesn't
necessarily. You have to check XCBConnSetupSuccessRepVendorLength or
whatever it's called.

For ScreenCount, there are two ways to do it. You've identified one of
them, and if you needed an iterator across the screens anyway then your
way makes the most sense. Otherwise, I believe there's a
XCBConnSetupSuccessRepRootsLength function you can call instead of the
Iter function.

> Before I commit that, any comments /changes to do ?

Commit early and commit often, right? Commits are cheap and make sure
you don't lose any of your hard work.

> Next thing to add to the tutorial : events and maybe some words about the
> extensions.
> 
> Jamey: don't you want to change the way the extensions are initialized ?

Oh, the XCB*Init functions should be considered deprecated. Crap, I
should fix that in the source. The right thing to do has been
implemented for a long time though: call, for example,

  const XCBQueryExtensionRep *shm = XCBGetExtensionData(c, &XCBShmId);

See XCBGetMaximumRequestLength in xcb/src/xcb_out.c for an example of
how to safely use an extension. See xcb/src/xcb_xid.c for an example of
how *not* to use an extension unless you want your program to fail an
assertion sometimes. ;-)

Using XCBPrefetchExtensionData first for all the extensions you need is
recommended for performance.

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20051210/25b116e2/attachment.pgp


More information about the Xcb mailing list