Girish Mahajan (Editor)

XCB

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Original author(s)
  
Bart Massey

Operating system
  
Written in
  
C

XCB

Developer(s)
  
Jamey Sharp, Josh Triplett, Bart Massey

Initial release
  
2001; 16 years ago (2001)

Stable release
  
1.12 / 18 May 2016; 10 months ago (2016-05-18)

XCB (X protocol C-language Binding) is a library implementing the client-side of the X11 display server protocol. XCB is written in the C programming language and distributed under the MIT License. The project was started in 2001 by Bart Massey and aims to replace Xlib.

Contents

Overview

XCB was designed as a smaller, modernized replacement for Xlib, previously the primary C library for communicating with the X window system, coinciding with a more complete overhaul of the X implementation that took place during the early 2000s. The main goals of XCB are to

  • Reduce library size and complexity;
  • Provide direct access to the X11 protocol.
  • The required size reduction is achieved primarily by restricting XCB's scope to handling the X protocol and omitting Xlib functionality such as its extensive utility library, much of which saw little use by applications. This results in a factor thirty reduction of the compiled library size (as of 2004). Secondary goals include making the C interface asynchronous, facilitating better multithreading and making it easier to implement extensions (via XML protocol descriptions).

    The core and extension protocol descriptions are in XML, with a program written in Python creating the C bindings. (Previous versions used XSLT and M4.)

    A further goal is to be able to use these protocol descriptions to create protocol documentation, more language bindings, and server-side stubs.

    Massey and others have worked to prove key portions of XCB formally correct using Z notation. (Xlib has long been known to contain errors.)

    Xlib compatibility

    Xlib/XCB provides application binary interface compatibility with both Xlib and XCB, providing an incremental porting path. Xlib/XCB uses the protocol layer of Xlib, but replaces the Xlib transport layer with XCB, and provides access to the underlying XCB connection for direct use of XCB. Xlib/XCB allows an application to open a single connection to the X display server and use both XCB and Xlib, possibly through a mixture of libraries designed for one or the other.

    Example

    XCB has a comparable, but slightly lower-level API than Xlib, as can be seen with this example.

    Protocol description

    Creators of XCB have invented a specialized interface description language to model X11 protocol in language-neutral way and facilitate generation of bindings to other programming languages. libxcb itself is implemented as a code generator and a tiny C stub of utility functions.

    Example:

    The XCB logo was produced by GearĂ³id Molloy, author of the web comic Neko the Kitty, and donated to the project.

    Other language bindings

  • XCB.pm - Perl module implementing bindings to XCB.
  • xpyb - The Python binding to the X Window System using XCB. As of June 2013, it does not support Python 3. Provided by freedesktop.org.
  • xcffib - Another Python binding which supports Python 2 & 3 as well as several more X extensions than xpyb.
  • References

    XCB Wikipedia


    Similar Topics