Graphical Interface Basics

The X Window System

Like other graphical user interfaces, the X Window System displays information and applications in rectangular windows arrayed on a desktop-style screen that can be resized or moved with a mouse. These windows make it possible to perform tasks that would be difficult or impossible in text-only environments.

Clients communicate with the X server via a set of requests and events. Some of these are specific to selection transfer, while others (such as window properties) allow clients to exchange information with one another.

X Window System

The X Window System, also known as X11, is a networked graphical display system. A program called a display manager runs an X server on a computer, and client programs running on other computers connect to that server to see a graphical desktop.

The X core protocol defines windows, pixmaps and other user interface elements that applications can build on. Various extensions to the protocol allow different clients connected to the same server to communicate via selection transfer, client-to-client events and other mechanisms. The X SHAPE Extension, for example, allows a window to carve away pixels that it wouldn’t normally own and give them to lower-level windows.

X Server

The X server is the central part of X Window System. It processes requests from applications (known as clients) and handles input from keyboards and mice.

For example, when a client creates a new window, pixmap or cursor, the X server assigns it an identifier in its namespace. The client then uses this identifier when communicating with the X server to transfer data about that resource.

This data structure saves memory space. Instead of storing an alpha mask for each window, the X server stores a list of rectangles that contain the areas where the window is visible.

X Clients

The X server communicates with client programs that connect to it. These may be local or remote. Dedicated X terminals use hardware to display windows, and they are considered clients of the X server program. Other applications, including window managers, realize more complex functionality by interacting with the server.

The client program requests services from the X server by sending messages that contain requests and events. The server responds with replies that can include new resources, such as windows, pixmaps and cursors.

When a resource is created, the X server assigns it an identifier in a 32-bit namespace. The client (transparently in Xlib or xcb libraries) uses this identifier to refer to the object in its requests to the X server.


The XID database is a file that contains information about the attributes of a specific item or species. Its use helps X clients identify unknown objects that they cannot positively identify by their own attributes alone.

A database may also contain a list of attributes that are common to all remaining items or species. These are shown in the Database menu as having a distribution number equal to the total number of remaining items/species. If an XID user marks these attributes as YES, this effectively reduces the number of possibilities.

X Attributes

X clients connect to a server to display and receive input. Windows, which are regions of the screen that can be drawn upon, form the basic building blocks of the X protocol.

Each window has a set of attributes and properties, stored on the server and accessible by clients using appropriate requests. Attributes are null-terminated Unicode strings that represent data.

A window has a bounding shape region (its X, Y, width and height), an event suppression mask, a background color or pattern and a border pixmap. A window can also have a parent and children. It can be mapped to the screen (as opposed to hiding it) using the XMapWindow request, at which point it is visible but not yet occluded.

X Properties

Properties are a mechanism for storing arbitrary data associated with windows. They are stored in the X server and can be transferred between clients in the same way as attributes. The X core protocol defines some predefined properties (such as name and size hints), but users can define arbitrary ones. Each property has a name, an atom representing its type, and a value. The atoms allow arbitrary new types to be defined.

A property can be a string, an integer, a pixmap, or other data. The atoms can be used to determine the size of the data in bytes, and the X server encodes this information for transmission.

X Events

The X server generates a number of events to notify clients of various activities. For example, when a client application selects text on a window, the server sends a selection event to the other clients handling that window.

Most key events are sent to the client holding input focus, which may be determined by manipulating a menu or other control, or by using a special hotkey. In a traditional X environment, composite extensions usually do not receive these events, as they store each window’s content in a non-overlapped offscreen buffer and then combine the visible segments onscreen for display.

Lead yourself back to the main page

X Window System and Window Manager: Controlling and Managing Windows in the X Server

X Window System and Window Manager

X handles most keyboard input by sending key events to the window with “input focus”. This window is usually highlighted in some way.

Window managers make it possible to control a wide range of details about how windows appear on the screen. This includes cosmetic details like color of windows borders and what elements are displayed on each window.

X Window System

The X Window System is a network-based graphical display system. It uses a client-server architecture where the X server controls access to hardware devices that enable user applications to display graphics on the screen. This includes both input devices like mice and keyboards as well as output devices such as video adapters and monitors.

The underlying X architecture allows for many different ways of managing on-screen space. One way is for the X server to manage windows, but this would violate the X philosophy that separates policy from process, so the X server typically leaves that task to another program called a window manager.

A window manager determines where to place windows on the screen, what sort of decorations (icons, title bars and borders) they have and provides mechanisms for interacting with them. Most window managers also provide facilities for launching other client programs through a menu.

In addition, many window managers use “compositing” techniques to give a more 3-D look to the on-screen contents and have features for resizing and moving windows as well as for arranging them in groups and stacks. This work can be done on the X server but it’s becoming more common for window managers to bypass this and do it on the client application itself.

X Window Manager

The X Window System works on a client/server model. The X server manages access to the graphics card and display screen, and clients (application programs) talk to it via the X protocol. Typically, these client programs are referred to as windows. For example, a typical X session might start up two xterms and an xclock as window programs before starting the fvwm window manager.

The architecture of X provides mechanisms for the server to impose its own policy on windows — moving them, iconifying them, etc. Historically, some toolkits have taken advantage of this infrastructure to manage the X window space. In modern times, though, most of the X work is done by another program — a program called a window manager.

Basically, a window manager is an application that decides where other windows should be placed, provides mechanisms for users to control those positions and sizes, and generally “decorates” the window area. Several such programs are available in the pkgsrc archive, including the very basic ctwm and the desktop environments of Openbox and Cinnamon. Others are a bit more elaborate, such as i3 and tiling managers like Larswm and LeftWM. Some offer compositing as well. All of these, of course, require the X server to be running.

X Server

The X server provides the screen on which other programs (called clients) are displayed. It also processes input from the mouse and keyboard. When a client program sends an event to the server, it is handled and a response is sent back to the client application. The X server can also perform graphics operations, such as rotating windows.

Normally, a desktop environment such as Gnome or KDE runs on top of the X server. In addition, many users have their own window managers. A window manager is a “meta-client” whose most basic function is to manage other client applications. Some window managers provide a way to launch other client applications; others simply allow the user to type standard commands into a command box and have the X server execute them.

There are a large number of window managers available for the X server. Some of them are graphical, while others are text-based. Several of these window managers are minimalist, aiming for simplicity and speed. Examples include icewm, evilwm, and jbwm. These are accompanied by more advanced GUIs such as Enlightenment, lxde, and gtk.

Walk back to the main page