--- driver/screens.c.bak 2008-12-03 22:56:43.000000000 -0800 +++ driver/screens.c 2008-12-03 22:57:56.000000000 -0800 @@ -407,36 +407,45 @@ monitor *m = (monitor *) calloc (1, sizeof (monitor)); XRROutputInfo *rroi = XRRGetOutputInfo (dpy, res, res->outputs[k]); - RRCrtc crtc = (rroi->crtc ? rroi->crtc : rroi->crtcs[0]); - XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, crtc); monitors[j] = m; m->screen = screen; m->id = (i * 1000) + j; m->desc = (rroi->name ? strdup (rroi->name) : 0); - m->x = crtci->x; - m->y = crtci->y; - if (crtci->rotation & (RR_Rotate_90|RR_Rotate_270)) + if (rroi->connection == RR_Disconnected || + (rroi->crtc == 0 && rroi->ncrtc == 0)) { - m->width = crtci->height; - m->height = crtci->width; + m->sanity = S_DISABLED; } + /* #### do the same for RR_UnknownConnection? */ else { - m->width = crtci->width; - m->height = crtci->height; + RRCrtc crtc = (rroi->crtc ? rroi->crtc : rroi->crtcs[0]); + XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, crtc); + + m->x = crtci->x; + m->y = crtci->y; + + if (crtci->rotation & (RR_Rotate_90|RR_Rotate_270)) + { + m->width = crtci->height; + m->height = crtci->width; + } + else + { + m->width = crtci->width; + m->height = crtci->height; + } + + XRRFreeCrtcInfo (crtci); } j++; - if (rroi->connection == RR_Disconnected) - m->sanity = S_DISABLED; - /* #### do the same for RR_UnknownConnection? */ - - XRRFreeCrtcInfo (crtci); XRRFreeOutputInfo (rroi); } + XRRFreeScreenResources (res); # endif /* HAVE_RANDR_12 */ }