Index: xorg-server-1.16.0/randr/rrcrtc.c =================================================================== --- xorg-server-1.16.0.orig/randr/rrcrtc.c +++ xorg-server-1.16.0/randr/rrcrtc.c @@ -307,13 +307,34 @@ static int mode_width(const RRModeRec *m } } -static void -crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) +static Bool +cursor_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) { - *left = crtc->x; - *top = crtc->y; - *right = crtc->x + mode_width(crtc->mode, crtc->rotation); - *bottom = crtc->y + mode_height(crtc->mode, crtc->rotation); + rrScrPriv(crtc->pScreen); + BoxRec bounds; + + if (crtc->mode == NULL) + return FALSE; + + memset(&bounds, 0, sizeof(bounds)); + if (pScrPriv->rrGetPanning) + pScrPriv->rrGetPanning(crtc->pScreen, crtc, NULL, &bounds, NULL); + + if (bounds.y2 <= bounds.y1 || bounds.x2 <= bounds.x1) { + bounds.x1 = 0; + bounds.y1 = 0; + bounds.x2 = crtc->mode->mode.width; + bounds.y2 = crtc->mode->mode.height; + } + + pixman_f_transform_bounds(&crtc->f_transform, &bounds); + + *left = bounds.x1; + *right = bounds.x2; + *top = bounds.y1; + *bottom = bounds.y2; + + return TRUE; } /* overlapping counts as adjacent */ @@ -325,8 +346,10 @@ crtcs_adjacent(const RRCrtcPtr a, const int bl, br, bt, bb; int cl, cr, ct, cb; /* the overlap, if any */ - crtc_bounds(a, &al, &ar, &at, &ab); - crtc_bounds(b, &bl, &br, &bt, &bb); + if (!cursor_bounds(a, &al, &ar, &at, &ab)) + return FALSE; + if (!cursor_bounds(b, &bl, &br, &bt, &bb)) + return FALSE; cl = max(al, bl); cr = min(ar, br); @@ -344,7 +367,7 @@ mark_crtcs(rrScrPrivPtr pScrPriv, int *r reachable[cur] = TRUE; for (i = 0; i < pScrPriv->numCrtcs; ++i) { - if (reachable[i] || !pScrPriv->crtcs[i]->mode) + if (reachable[i]) continue; if (crtcs_adjacent(pScrPriv->crtcs[cur], pScrPriv->crtcs[i])) mark_crtcs(pScrPriv, reachable, i); @@ -1606,10 +1629,8 @@ static Bool check_all_screen_crtcs(Scree int left, right, top, bottom; - if (!crtc->mode) - continue; - - crtc_bounds(crtc, &left, &right, &top, &bottom); + if (!cursor_bounds(crtc, &left, &right, &top, &bottom)) + continue; if ((*x >= left) && (*x < right) && (*y >= top) && (*y < bottom)) return TRUE; @@ -1628,10 +1649,9 @@ static Bool constrain_all_screen_crtcs(D int nx, ny; int left, right, top, bottom; - if (!crtc->mode) - continue; + if (!cursor_bounds(crtc, &left, &right, &top, &bottom)) + continue; - crtc_bounds(crtc, &left, &right, &top, &bottom); miPointerGetPosition(pDev, &nx, &ny); if ((nx >= left) && (nx < right) && (ny >= top) && (ny < bottom)) {