summaryrefslogtreecommitdiff
path: root/xinerama_test.c
blob: 4f546b5b18492bdc2de1e89d3cf25906895158fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>

//
//  gcc xinerama_test.c -lX11 -lXinerama -o xinerama_test
//

int main (int argc, char *argv[])
{
    XineramaScreenInfo *info;
    int numOfHeads;
    Display *dpy;

    dpy = XOpenDisplay(NULL);
    if (!dpy)
	return -1;

    info = XineramaQueryScreens(dpy, &numOfHeads);
    if (!info)
	printf("Xinerama not available\n");
    else
    {
	int i;
	for (i = 0; i < numOfHeads; i++)
	    printf("Head %d: num %d, Origin %d %d, Size %d %d\n", i,
		    info[i].screen_number, info[i].x_org, info[i].y_org,
		    info[i].width, info[i].height);
	XFree(info);
    }

    XCloseDisplay(dpy);

    return 0;
}