Understanding the X Window System

Understanding the X Window System

The name X Window System (X for short) is loosely applied to several components that facilitate window-based graphics output (or a graphical interface) on a variety of bitmapped displays. A bitmapped display has two distinct components: a video monitor on which the graphics output appears and a video card (or graphics card)-either a plug-in card or some circuitry built into the system's motherboard-that causes the output to appear on the monitor.

At the heart of X is the X server-a process (computer program) running on a computer that has a bitmapped display, a keyboard, and a mouse. Applications-X clients-that need to display output do so by communicating with the X server via one of several possible interprocess communication mechanisms. The communications between the X clients and the X server follow a well-defined protocol: the X protocol. In addition to the X server, the clients, and the X protocol, the term X encompasses a library of routines known as Xlib, which constitutes the C-language interface to the facilities of the X server.

X Server and Clients

When you run X on your system, the X server runs on your computer and controls the monitor, keyboard, and mouse. The server responds to commands that X clients send that open windows and draw in those windows. The X clients may run locally or on remote systems. This arrangement is known as the client/server model. As the name implies, the server provides a service that the client requests. Usually, clients communicate with the server through a network, with client and server exchanging data using a protocol that both understand.

You may already have seen the client/server model in action. A file server, for example, stores files and allows clients to access and manipulate those files. Another common application, the database server, provides a centralized database from which clients retrieve data by sending queries. Similarly, the X display server offers graphics-display services to clients that send X protocol requests to the server.

One major difference exists between the X server and other servers, such as file and database servers. File servers and database servers are usually processes executing on remote machines, but the X server is a process executing on the computer where the monitor is located. The X clients may run locally or on remote systems.

Insider Insight 

In the PC LAN's client/server model, applications are typically stored on a central server. Users access these server-based applications from client PCs. When you run an application from a PC, the application executes in your PC's processor. In the X client/server model, the situation is reversed. The X server runs on your PC and manages the display, keyboard, and mouse. The X clients-graphical applications that display output using X-are the ones that run in the server's processor. In other words, the X server runs in a location you typically associate with the client (as in the client PC in a PC LAN). Keep this distinction in mind when working with the X client/server model.

Graphical User Interfaces and X

An application's user interface determines its appearance (look) and behavior (feel). When the user interface uses graphic objects, such as windows and menus, we call it a graphical user interface (GUI). You can also call a GUI a point-and-click user interface because users generally interact with a GUI by moving the mouse pointer onscreen and clicking the mouse button. To confirm the closing of a file, for example, the user may click the mouse button while the mouse pointer is inside a button labeled OK. By now everyone is so used to GUIs that you'd describe that action of clicking the OK button as 'click OK.'

GUIs were originally developed at the Xerox Palo Alto Research Center (PARC). Subsequently, Apple Computer made such interfaces popular in its Lisa and Macintosh systems. Today, GUIs are available for most systems. Microsoft Windows is available for most IBM-compatible PCs; Motif, GNOME, and KDE (built on X) are avialable for Linux and UNIX systems.

Most GUIs, including Motif, GNOME, and KDE, have three components:

  • A window system

  • A window manager

  • A toolkit

The graphical window system organizes graphics output on the display screen and performs basic text- and graphics-drawing functions. The X Window System is the window system used by all X-based GUIs, such as GNOME and KDE.

The window manager enables the user to move and resize windows. The window manager is also partly responsible for the appearance of the windows because it usually adds a decorative frame to them. The window manager also manages input focus, the mechanism by which the user can select one of several windows onscreen and make that one the current active window (the window with which the user intends to interact). This process is called giving the input focus to a window. For GUIs based on the X Window system, a window manager is an X client, just like any other X application. For example, GNOME comes with the metacity window manager.

The third component, the toolkit, is a library of routines with a well-defined programming interface. This toolkit is primarily of interest to programmers because it enables them to write applications that use the facilities of the window system and that have a consistent look and feel. For example, GNOME comes with a toolkit named Gtk+ (GIMP toolkit), and KDE comes with the Qt toolkit.

X on Red Hat Linux

The X Window System for Red Hat Linux comes from the XFree86 project-a cooperative project of programmers who bring X to the PC. (You can access the XFree86 home page at http://www.xfree86.org/.) As a result, the Linux version of X is called XFree86.

Insider Insight 

The X server configures the display (number of colors, resolution in terms of number of pixels horizontally and vertically), mouse, and keyboard based on information stored in a configuration file. Red Hat Linux comes with XFree86 version 4.2.0 that uses a single X server that loads different driver modules to support different video cards. A configuration file-/etc/X11/XF86Config-configures the X server to work on a specific video card and display output in a specific resolution.

To configure X, you must prepare the X configuration file. The configuration file contains information about your video card, monitor, keyboard, and mouse. Red Hat Linux comes with a GUI utility program called redhat-config-xfree86 that enables you to create the XF86Config configuration file.