Resources
Programming with Xlib, Xt and Motif
An annotated reading guide to tutorials, books, specifications and example programs.
There are several useful entry points into X programming. Xlib exposes windows, events and drawing; Xt provides the toolkit framework; Motif provides widgets for building an interface. This guide connects introductory material with the references you will need when working on real programs.
Choose a starting point
- New to the terminology: read the X programming stack.
- Ready to write C: build a small Motif application.
- Reading an existing application: use the Xt overview to identify its widget tree, resources and callbacks.
- Looking for an old tutorial: start with the archive guide.
Tutorials and examples
The widget gallery introduces common controls with a runnable example. Follow the X resources guide to experiment with names, classes, colours and application defaults.
Compare the raw Xt and Athena counter examples to see the boundary between toolkit infrastructure and a widget set. Both have screenshots, downloadable C source and build commands.
Christophe Tronche's Xlib tutorial works through the steps needed to make a window and draw into it. It is useful for understanding why creating a window, displaying it and handling events are separate tasks. Its examples use C++, as the author notes; account for that when compiling or adapting them to C.
The Motif source releases include demonstration programs. Once the introductory example here makes sense, study a demo that uses the particular widget you need. Match the source to the version of Motif you are building against.
CDE's documentation collection is useful when moving from individual widgets to desktop integration. It includes programming, internationalisation and application-builder material. CDE-specific facilities are additional dependencies, not prerequisites for every Motif program.
Books
The illustrated book catalogue covers O’Reilly’s X Window System series from Volume 0 through 6B, including the Standard and Motif variants, and other useful Motif books. Each entry includes a summary, author, edition, publication date, ISBN and a bibliographic source.
O’Reilly’s Motif Open Books page also provides access to the Motif programming and reference manuals.
Xmt: Motif Tools
Xmt adds widgets and utilities on top of Motif and Xt, with an emphasis on describing interfaces through resources and reducing repetitive application code. Our separate guide introduces the library, David Flanagan’s Motif Tools book, and the project’s source and documentation resources.
Specifications and manual pages
- Xlib — C Language X Interface: a detailed reference for Xlib calls. This linked edition belongs to X11R7.6; use it alongside the headers and manuals installed on your system.
- X Toolkit Intrinsics specification: consult for the precise Xt model and API contracts.
- X.Org documentation directory: a route into protocol, library and client documentation.
Installed manual pages are often the fastest reference while coding. Depending
on your system's documentation packages, try man XtVaAppInitialize,
man XmPushButton and man XmStringFree.