Developer(s) | X.Org Foundation |
---|---|
Initial release | ~1985 |
Written in | C |
Type | Library |
Website |
www |
Xlib (also known as libX11) is an X Window System protocol client library written in the C programming language. It contains functions for interacting with an X server. These functions allow programmers to write programs without knowing the details of the . Few applications use Xlib directly; rather, they employ other libraries that use Xlib functions to provide widget toolkits:
Xlib appeared around 1985, and is currently used in GUIs for many Unix-like operating systems. The XCB library is an attempt to replace Xlib. While Xlib is still used in some environments, modern versions of the X.org server implement Xlib on top of XCB.
The main types of data in Xlib are the Display
structure and the types of the identifiers.
Informally, a display is a physical or virtual device where graphical operations are done. The Display
structure of the Xlib library contains information about the display, but more importantly it contains information relative to the channel between the client and the server. For example, in a Unix-like operating system, the Display
structure contains the file handle of the socket of this channel (this can be retrieved using the ConnectionNumber
macro.) Most Xlib functions have a Display
structure as an argument because they either operate on the channel or are relative to a specific channel. In particular, all Xlib functions that interact with the server need this structure for accessing the channel. Some other functions need this structure, even if they operate locally, because they operate on data relative to a specific channel. Operations of this kind include for example operations on the event queue, which is described below.
Windows, colormaps, etc. are managed by the server, which means that the data about their actual implementation is all stored in the server. The client operates on these objects by using their identifiers. The client cannot directly operate on an object, but can only request the server to perform the operation specifying the identifier of the object.