Programming with Xlib, Xt and Motif — MotifCentral

MotifCentral:/programming

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

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

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.

Ready. libXm / Xt / Xlib