- /* window area geometry */
- if(XineramaIsActive(dpy) && (info = XineramaQueryScreens(dpy, &n))) {
- if(n > 1) {
- int di, x, y;
- unsigned int dui;
- Window dummy;
- if(XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui))
- for(i = 0; i < n; i++)
- if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height))
- break;
+ if(XineramaIsActive(dpy))
+ info = XineramaQueryScreens(dpy, &n);
+ for(i = 1, nn = n; i < n; i++)
+ if(info[i - 1].x_org == info[i].x_org && info[i - 1].y_org == info[i].y_org
+ && info[i - 1].width == info[i].width && info[i - 1].height == info[i].height)
+ --nn;
+ n = nn; /* we only consider unique geometries as separate screens */
+#endif /* XINERAMA */
+ /* allocate monitor(s) for the new geometry setup */
+ for(i = 0; i < n; i++) {
+ if(!(m = (Monitor *)malloc(sizeof(Monitor))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
+ m->next = newmons;
+ newmons = m;
+ }
+ /* initialise monitor(s) */
+#ifdef XINERAMA
+ if(XineramaIsActive(dpy)) {
+ for(i = 0, m = newmons; m; m = m->next, i++) {
+ m->num = info[i].screen_number;
+ m->mx = m->wx = info[i].x_org;
+ m->my = m->wy = info[i].y_org;
+ m->mw = m->ww = info[i].width;
+ m->mh = m->wh = info[i].height;