What is the difference between X11 and Xlib

x11xorg

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

Best Answer

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

Related Question