Xinerama
Xinerama is an extension for X servers that allows multiple screens to behave like a single large one. It is thus possible in X Window systems to use large desktops that are displayed on several monitors. The extension has been available since XFree86 / X.Org X11 Release 6 Version 4.0.
functionality
Each session in the X Window System is assigned to a display . The term describes one or any number of monitors ( screens ) and input devices such as mice or keyboards . In principle, any number of monitors can be used; thanks to graphics cards with multi-head , this B. nowadays possible with commercially available personal computers . However, these screens are viewed independently of one another in the X Window System: They can have completely different properties, for example different resolutions or color depths . Technically speaking, each screen has its own root window . In the X Window System, every window (except the root windows) needs a parent window outside of which it cannot be displayed. With the Xinerama extension, all screens can be combined to form a large desktop, so that a large root window is created that spans all screens. Windows can now overlap the screens at will.
An X server that masters Xinerama offers its own API via which an X client, e.g. B. a window manager that can query the monitor configuration. This information can then be used to place windows in such a way that they do not protrude beyond the individual monitor boundaries, different background images are displayed on the individual screens, taskbars only show on one screen, etc.
API
The Xinerama extension offers a C -API with which the size and position of the individual screens can be queried:
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <stdio.h>
int main()
{
Display* dis = XOpenDisplay(NULL); /* Wert aus DISPLAY-Variable verwenden */
const Screen* scn = DefaultScreenOfDisplay(dis);
// Gesamtgröße des Desktops:
const int total_width = scn->width;
const int total_height = scn->height;
// Frag ab, ob Xinerama-Support vorhanden:
int event_base, error_base;
const Bool ext_okay = XineramaQueryExtension( dis, &event_base, &error_base);
if(!ext_okay) { /* no xinerama support! */ return 1; }
int number_of_screens = 0;
// Benutze die Extension, um Größe der Screens abzufragen:
XineramaScreenInfo* xsi = XineramaQueryScreens( dis, &number_of_screens);
XineramaScreenInfo* p;
for(p=xsi; p<xsi+number_of_screens; ++p)
{
printf("Screen #%d at position (%d, %d). Size: %d x %d pixels\n",
p-xsi, p->x_org, p->y_org, p->width, p->height);
}
XFree(xsi);
XCloseDisplay(dis);
return 0;
}
Alternatives
The X RandR extension, which was originally only intended to change the properties of the X Screen (color depth, resolution, etc.) at runtime, is available from version 1.3. also the merging of several “screens” into one overall picture, as offered by Xinerama. X clients that use the old Xinerama API therefore also work under X RandR, but with the restriction that they cannot be informed about subsequent changes in the arrangement of the screens.
Some graphics card manufacturers offer an improved version of multi-screen operation under different names. In the case of graphics cards that have several screen outputs, it is possible to distribute a desktop over several screens without reducing the screen build-up speed.
See also
- Distributed Multihead X Project , virtual monitor distributed over several PCs
- Multi-Head - multiple screens on one computer