4

I am not sure if I have got it right. Xlib is a library to interact with X server. X11 is just another name for X server.

Is X server just a single library? if so, why we can't access it directly? why we need Xlib?

Thanks in advance

11

Actually, strictly speaking, X11 is the communication protocol between an X client application and an X server. The X server is the part of the system that communicates with the hardware and provides basic concepts, in particular the notion of a window on the screen, with potentially overlapping windows, and one window having the input focus. (The X server does not handle window decorations, menus, keyboard shortcuts, or anything else that is the job of the window manager.)

X is called X because it was (in part) a successor to the W window system, and X11 is version 11 of X. It took about 3 years to reach version 11 (from 1984 to 1987) and the core protocol has been stable since then.

X11 is also the base name of a software distribution that included libraries, client applications and server code using the X11 protocol. That software distribution is known as the X Window System (version 11), or X or X11 for short. This software distribution originally came from MIT, where X had been invented; it then had a sometimes tumultuous history, with an MIT-led consortium producing versions up to X11R6.3.

Nowadays, the de facto reference implementation of the X Window System is the one by the X.Org Foundation. This is a usable implementation, used by virtually all X11 installations today.

There are several X servers, most of them sharing a code base. Most users use the X.org Xorg server, which communicates with most display hardware out there. There are other servers such as Xnest, which shows an X display inside an X window on another display, and Xvfb, which is a virtual display that remains only in memory.

Xlib (which has the shared object name libX11) is just one of the libraries in the X Window System. It's a basic wrapper around the client side of the X11 protocol. Almost all X client use this library (many of them indirectly through higher-level libraries).

8

The "X Window System version 11" is the whole shebang.

The X11 server is not a library but a program handling at least a mandatory frame buffer and usually input devices like a keyboard, a mouse or a touchscreen. There are various X server implementations, X.org being the prominent one. Some of them are not directly handling a physical display/mouse/keyboard combination but are purely software, like Xnest, Xephyr, Xvfb, Xvnc.

X11 clients are programs too, connecting either locally or remotely to the X server using the X11 protocol, displaying windows, drawing graphics, pixmaps and text inside of them and getting input devices events. Note that some X clients like Xephyr are also X servers, some are other protocols server X11vnc, and some are clients to more than one server: x2x.

There is a specific class of clients, named window managers, which are designed to (re)position and decorate top windows. Unlike with other windowing systems, the user is able to choose which window manager he would like to use.

Most of the clients are directly or indirectly using Xlib at the lower level, but there are alternatives like Xcb. Usually, clients are using higher level toolkits like GTK+, QT and many others to simplify development and provide an homogeneous look.

  • Xvnc (as provided by several vnc server implementations) implements a X server. x11vnc does not (it provides with VNC access to a (separate) X server). – Stéphane Chazelas Mar 10 '14 at 9:23
  • @StephaneChazelas Indeed, thanks ! Answer corrected. – jlliagre Mar 10 '14 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.