This book provides an overview of the X Window System focusing on characteristics that have significant impact on the development of both application programs and widgets. We pay special attention to applications that go beyond graphical user interfaces (GUIs); therefore we discuss issues affecting video games, visualization and imaging programs, and designing widgets with a complex appearance. While the book does not assume previous knowledge of X, it is intended for experienced programmers, especially those who want to write programs that go beyond simple GUIs.
X is the dominant window system under Unix, and X servers are available for Microsoft Windows, thus enabling graphics over a network in the PC world. While Java offers an apparently universal graphics library (the abstract window toolkit), the reality is quite different: For high-quality graphics and image display, we must program on the target platform itself (X or one of Microsoft’s APIs) rather than rely on Java peer objects.
X is a vast subject, so it is impossible to provide a complete coverage in a few hundred pages. Thus we selected topics that are fundamental to the system, so that the reader who masters them should be able to read the documentation of the numerous libraries and toolkits. Therefore we provide documentation on the most important Xlib and X toolkit functions only.
Most of the existing X literature and X toolkits (such as Motif) focus on GUI applications. This excludes such applications as visualization, imaging, video games, and drawing programs. Such applications may have few windows and a relatively simple layout but the appearance of each window and the user interaction can be quite complex. Usually the applications programmer is left to struggle with the low-level Xlib library or to use an existing toolkit component (widget) for what it was not designed.
If the reader must write an application that cannot be readily assembled from the widgets of an existing toolkit, then it is necessary to understand not only drawing functions, but also such issues as resource definition, selections (for interclient communication), and widget writing. Even if we rely on an existing toolkit, understanding these issues clarifies the functionality of the components and their interactions with each other. Quite often the best solution for a complex application is to write an extension of a toolkit.
In discussing toolkits we tried to avoid limiting our description to a single toolkit, such as Motif, to emphasize concepts in contrast to implementation details. A small Starter toolkit is used for rapid prototyping and facilitating drawing operations that normally require low-level Xlib functions. The code of that toolkit as well as code in the examples can be obtained through anonymous ftp as described in Software Installation.