25 XRRMonitorInfo *ps_monitors;
28 int evt_base, err_base, ver_maj, ver_min;
33 if(XRRQueryExtension(disp, &evt_base, &err_base) != True) {
36 fprintf(stderr,
"No RANDR on the server.\n");
43 if(XRRQueryVersion(disp, &ver_maj, &ver_min) == 0) {
46 fprintf(stderr,
"Couldn't get server RANDR version.\n");
50 if(ver_maj < 1 || (ver_maj == 1 && ver_min < 5)) {
52 fprintf(stderr,
"Server has RANDR %d.%d, we need 1.5+.\n",
59 ps_monitors = XRRGetMonitors(disp, rootw, 1, &i_nmonitors);
60 if(ps_monitors == NULL || i_nmonitors == 0) {
61 fprintf(stderr,
"XRRGetMonitors failed\n");
71 monitor_names = calloc((i_nmonitors + 1),
sizeof(
char *));
72 if(monitor_names == NULL) {
78 for(
int i = 0; i < i_nmonitors; i++) {
82 ps_monitors[i].height);
84 char *name = XGetAtomName(disp, ps_monitors[i].name);
86 fprintf(stderr,
"NEW area: %s%s",
87 name != NULL ? name :
"",
88 name != NULL ?
":" :
"");
90 fprintf(stderr,
"\n");
93 monitor_names[i] = strdup(name);
97 monitor_names[i] = strdup(
"");
103 XRRFreeMonitors(ps_monitors);
RArea RAreaNew(int x, int y, int width, int height)
Construct an RArea from given components.