I am trying to understand how different components of a Linux system interact with the services offered by a display server. Before complicating the question with Wayland-based display servers, let me first focus on X11:
- I know that in order to implement a very basic GUI application for an X11-based system, it is theoretically possible to program against X11's C library binding and make use of low-level primitives such as
XDrawStringto create a specific X client. Is this also the API that common GUI toolkits (such as GTK or Qt) make use of at the lowest level of their Linux implementation? Or do they draw their buttons and text fields in a different manner?
- According to this post, one the job of a window manager is to control the placement of a window. How exactly does this happen? Is the display server aware of every single window that the window manager wants to be shown and, for each of these windows, expects the window manager to provide it with a position and the desired dimensions? And when the window gets resized, for instance, it is the window manager's duty to update these dimensions?
- Considering the post from above again, another job of the window manager is to decorate the window, i.e., draw the borders and controls of the application. How does the window manager do this? Does it again use above-mentioned X11 primitives to draw objects around the actual X client? And if it does: How does it know which menus the developer of the X client programmed into its GUI?
- If we are not only running a window manager, but a complete desktop environment such as GNOME: How are environment-specific components such as panels and window switchers drawn? Do they run as individual X clients?
And finally, consider Wayland instead of X11. If I understand this article correctly, Wayland-based display servers are called “Wayland compositors” and integrate the functionality of a compositing window manager. Does this mean that a Wayland compositor such as Mutter is entirely incompatible with traditional window managers such as Compiz?