File: ls_xinerama.c

package info (click to toggle)
notion 3%2B2014010901-1
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 4,940 kB
  • ctags: 6,104
  • sloc: ansic: 46,870; sh: 2,008; makefile: 598; perl: 270
file content (25 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (2)
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
#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>
#include <stdbool.h>
#include <stdio.h>

int main() {
    Display *dpy = XOpenDisplay(NULL);
    int xinerama_event_base;
    int xinerama_error_base;
    bool xinerama_ready = XineramaQueryExtension(dpy,&xinerama_event_base, &xinerama_error_base);

    fprintf(stdout, "Basic Xinerama screen information - for all the details run 'xdpyinfo -ext XINERAMA'\n");

    if (!xinerama_ready)
        fprintf(stderr, "No Xinerama support detected, mod_xinerama won't do anything.");
    else {
        int nRects,i;
        XineramaScreenInfo* sInfo = XineramaQueryScreens(dpy, &nRects);
        for(i = 0 ; i < nRects ; ++i) {
            fprintf(stdout, "Screen %d: %dx%d+%d+%d\n", i, sInfo[i].width, sInfo[i].height, sInfo[i].x_org, sInfo[i].y_org);
        }
    }

    return 0;
}