int main(int argc, char **argv) { if (argc != 9) { fprintf(stderr, "Usage %s [WA X] [WA Y] [WA W] [WA H] [WIN X] [WIN Y] [WIN W] [WIN H]\n", argv[0]); return 1; } wa_sx = atoi(argv[1]); wa_sy = atoi(argv[2]); wa_ex = wa_sx + atoi(argv[3]); wa_ey = wa_sy + atoi(argv[4]); win_sx = atoi(argv[5]); win_sy = atoi(argv[6]); win_ex = win_sx + atoi(argv[7]); win_ey = win_sy + atoi(argv[8]); Display *dpy = XOpenDisplay(NULL); if (dpy == NULL) { fprintf(stderr, "error: cannot open the display\n"); return 1; } int n; XineramaScreenInfo *info; int screen = DefaultScreen(dpy); if (info = XineramaQueryScreens(dpy, &n)) { int i; for (i = 0; i < n; ++ i) { process_screen(info[i].x_org, info[i].y_org, info[i].x_org + info[i].width, info[i].y_org + info[i].height); } } else { process_screen(0, 0, DisplayWidth(dpy, screen), DisplayHeight(dpy, screen)); } XFree(info); XCloseDisplay(dpy); printf("%d %d %d %d", _sx, _sy, _ex - _sx, _ey - _sy); return 0; }
/* * static gint delete_screens(RADContext *ctxt) * * Removes the SCREENDELETE elements from the main context. */ static gint delete_screens(RADContext *ctxt) { gint rc; xmlNodePtr cur; cur = ctxt->delta.screens; while (cur != NULL) { if ((cur->type == XML_ELEMENT_NODE) && (xmlStrcmp(cur->name, "SCREENDELETE") == 0)) { rc = process_screen(ctxt, ctxt->main.screens, cur); if (rc != 0) return(rc); } cur = cur->next; } return(0); } /* delete_screens() */