How to Program using the X Window System (X11)

Introduction

The purpose of these pages and the ones depending on it is to enable anyone who has knowledge of C but no knowledge of the internals of X to write X applications.

To this end, they contain a tutorial, on which work is in progress (it can be useful, though), and links to documentation. When the tutorial is finished, I shall try to put up example programs and detailed information as well.

The tutorial uses the Athena widget set. This is because of several reasons: the Athena widget set, unlike the Motif set, was free at the time I started writing. Moreover, it is included with each and every X distribution I know. And, of course, it's my personal favourite. I'm prepared to fight a bitter holy war about how Athena is better than GTK, Qt, Motif and any other system combined any day :)

Anyway, a lot of the basics in the tutorial are equally valid for Athena and Motif users. Therefore, even if you would rather use Motif instead of Athena, these pages may still have their use to you.

Tutorial

  1. A bit of theory
  2. Our first program
  3. It's All About Resources
  4. Pixmaps and Bitmaps
  5. Colours and Drawing
  6. Useful Widgets and Resources
  7. Callbacks
  8. Events, Translations and Actions
  9. Other Windows
  10. Menus
  11. Text Widgets
  12. Scrolling

Reference

I'll add detailed information about the widgets here.

Documentation

X Consortium documentation:

For more X Consortium documentation, refer to ftp.x.org (for X11R6.6, the docs directory is at pub/R6.6/xc/doc, with the PostScript documents under hardcopy).

Other documentation

Parts of the tutorial are (lightly) based on the X11 notes; before I got smart and discovered the X Consortium documentation, this was my only source of information on X11 (except, of course, for my guru, Marc Seutter, who taught me almost everything I know - thanks, Marc)

Here is a manual for the Xpm library, in gzipped PostScript, 43K.

Albert Ward has translated this tutorial into Bulgarian; the translation is available here.


Last updated: June 17, 2002 by Jaap Boender