Jump to content

X Window System protocols and architecture

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by David Gerard (talk | contribs) at 11:01, 26 January 2005 (create (branched from X Window System; many holes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

You must add a |reason= parameter to this Cleanup template – replace it with {{Cleanup|reason=<Fill reason here>}}, or remove the Cleanup template.

In computing, the X Window System (commonly X11 or X) is a network-transparent windowing system for bitmap displays. This article details the protocol and technical structure of X11.

X Window System logo
X Window System logo

The X client-server model and network transparency

X is based on a client-server model. An X server program runs on a computer with a graphical display and communicates with various client programs. The server accepts requests for graphical output (windows) and sends back user input (keyboard, mouse).

This client-server terminology — your terminal is the "server", the remote applications are the "clients" — often confuses new X users, because the terms appear reversed. But X takes the perspective of the program, rather than the end-user or the hardware: the remote programs connect to the X server display running on the local machine, and thus act as clients; the local X display accepts incoming traffic, and thus acts as a server.

In this example, the X server takes input from a keyboard and mouse and displays to a screen. A web browser and a terminal emulator run on the user's workstation, and a system updater runs on a remote server but is controlled from the user's machine. Note that the remote application runs just as it would locally.

The communication protocol between server and client runs network-transparently: the client and server may run on the same machine or on different ones, possibly with different architectures and operating systems. A client and server can even communicate securely over the Internet by tunneling the connection over an encrypted connection.

Design principles

Scheifler and Gettys set out the early principles of X as follows (as listed in Scheifler/Gettys 1996):

  • Do not add new functionality unless an implementor cannot complete a real application without it.
  • It is as important to decide what a system is not as to decide what it is. Do not serve all the world's needs; rather, make the system extensible so that additional needs can be met in an upwardly compatible fashion.
  • The only thing worse than generalizing from one example is generalizing from no examples at all.
  • If a problem is not completely understood, it is probably best to provide no solution at all.
  • If you can get 90 percent of the desired effect for 10 percent of the work, use the simpler solution. (See also Worse is better.)
  • Isolate complexity as much as possible.
  • Provide mechanism rather than policy. In particular, place user interface policy in the clients' hands.

X services and protocol interactions

The X server provides only the following. All else is provided by client programs.

  • Input handling: Keyboard and mouse input are passed to clients as events via the window manager—which, as far as X is concerned, is just another client.
  • Window services: Clients ask the server to create or destroy windows. Windows may be nested hierarchically. Clients can request information about windows.
  • Text and fonts: Clients ask for text to be drawn at a given location in a given font. The client can request information on available fonts.
  • Graphics: Clients ask the server to draw pixels, lines or shapes or perform bitmap operations.
  • Resource management: The X resource manager provides a content addressable database for clients. Clients can be implemented so they are customizable on a system and user basis.

There are four types of communication between X clients and the server:

  1. Request: The client requests an action or information.
  2. Reply: The server responds. Note that not all requests generate replies.
  3. Event: The server sends an event to the client, e.g. keyboard or mouse input, or a window being moved, resized or exposed.
  4. Error: The server sends an error packet if a request is invalid. Note that requests are queued, so an error packet may not be sent immediately.

User interface elements

Early widget toolkits for X included Xaw (the Athena Widget Set), OLIT (OPEN LOOK Intrinsics Toolkit), XView, Motif and Tk. OLIT and XView function as the base toolkits for AT&T and Sun's OPEN LOOK GUI.

Motif provides the base toolkit for the Common Desktop Environment (CDE), which is the standard desktop environment used on commercial Unix systems such as Solaris and HP-UX. (GNOME is offered in Solaris 9 and will be standard in future versions.)

More modern toolkits include Qt (used by KDE), GTK+ (used by GNOME), wxWidgets, FLTK and FOX.

The ICCCM is a specification for client interoperability. However, it is notorious for a difficult and confusing API [1]. Consistency of application look and feel and communication is typically addressed by programming to a given desktop environment.

X display managers

An X display manager keeps the X server process alive on the X server machine, connecting it to a physical screen and serving a login prompt on this screen. XDM is the basic display manager supplied with X. Others include GDM (GNOME), KDM (KDE), wdm (using the WINGs widget set used in Window Maker) and entrance (using the architecture used in Enlightenment v.17).

Extensions

The X server was designed to be simple but extensible. As such, much functionality now resides in extensions to the protocol.

Color modes

The colors used in X Window Systems sometimes confuse users, as old or special-purpose applications may require a certain color mode. Most modern applications use a color mode called "TrueColor", but historically X has supported several different modes:

  • DirectColor
  • GrayScale
  • PseudoColor (Chunky)
  • StaticColor
  • StaticGray
  • TrueColor

See also

References