W3cubDocs

/GTK 4.0

Understanding the X11 architecture

People coming from a Windows or MacOS background often find certain aspects of the X Window System surprising. This section introduces some basic X concepts at a high level. For more details, the book most people use is called the Xlib Programming Manual by Adrian Nye; this book is volume one in the O’Reilly X Window System series.

Standards are another important resource if you’re poking in low-level X11 details, in particular the ICCCM and the Extended Window Manager Hints specifications. freedesktop.org has links to many relevant specifications.

The GDK manual covers using Xlib in a GTK program.

Server, client, window manager

Other window systems typically put all their functionality in the application itself. With X, each application involves three different programs: the X server, the application (called a client because it’s a client of the X server), and a special client called the window manager.

The X server is in charge of managing resources, processing drawing requests, and dispatching events such as keyboard and mouse events to interested applications. So client applications can ask the X server to create a window, draw a circle, or move windows around.

The window manager is in charge of rendering the frame or borders around windows; it also has final say on the size of each window, and window states such as minimized, maximized, and so forth. On Windows and MacOS the application handles most of this. On X11, if you wish to modify the window’s state, or change its frame, you must ask the window manager to do so on your behalf, using an established convention.

GTK has functions for asking the window manager to do various things; see for example gtk_window_minimize() or gtk_window_maximize(). Keep in mind that most window managers will ignore certain requests from time to time, in the interests of good user interface.

© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/gtk-X11-arch.html