Fundamentals of Xlib Programming by Examples

There are a number of publications which explain graphics programming using the X Window System. Recent publications focus on using toolkits for X Window building. Older publications move from a brief introduction of using Xlib on to toolkit use. Such an approach is valid because most X Window programming is done using toolkits, just as most software is written in high level programming languages as opposed to assembler. Xlib can be likened to the assembler language of X Window programming while toolkits are analogues to high level languages.

'Xlib' is the 'library' of 'X'. It's functions access the messages exchanged between the user written client program and the X Window server to produce the graphic interactions. Every installation of X Window contains the Xlib library but this is not necessarily true of a particular toolkits. Because Xlib operates directly on the graphic messages, programming using Xlib requires a knowledge of how X Window works. The 'mechanism not policy' design goal of X Window can be accessed by a Xlib program without the 'policy and look' generally embedded within a toolkit. But to achieve this, Xlib programs are more complex than toolkit programs to do the same thing.

The attached document is a programming illustration for using Xlib and thus of the X Window System. Small, complete programs are given to demonstrate the use of the more significant aspects of X Window through the functions provided in the Xlib library. All programs are written in standard C and have been executed under Linux. Each chapter is centred on a particular topic. At the end of most chapter sections, questions are provided to guide the reader in considering implications of the material presented.

Note: The first and final chapters of this work are currently being worked upon. Editing also is yet to be done.

Document version: 0.5