X Window Programming/XCB

Introduction
XCB (X C Binding) is a C language binding for the X Window System. It aims to replace ../XLib/. The project was started in 2001 by Bart Massey.

Xlib/XCB provides application binary interface compatibility with both Xlib and XCB, providing an incremental porting path.

Aims of XCB
The main aims of XCB are:


 * reduction in library size and complexity;
 * direct access to the X11 protocol.

Secondary aims include making the C interface asynchronous, facilitating better multithreading and making extensions easier to implement (via XML protocol descriptions).

The core and extension protocol descriptions are in XML, with the C bindings created via XSLT. A tertiary aim is to repurpose these protocol descriptions for the creation of protocol documentation, further language bindings, and server-side stubs.

Massey has worked to prove XCB formally correct, using Z notation. (Xlib has long been known to contain errors.)

Old Example
XCB has a comparable, but slightly lower-level API than XLib, as can be seen with these examples.