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.
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.
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 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.
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.
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.