From 42441c56e91cd5e8cadfb585d0c9561923b65864 Mon Sep 17 00:00:00 2001 From: Chris Bagwell Date: Sat, 24 Mar 2012 22:30:18 -0500 Subject: [PATCH xserver] Account for panning/scaling when bounding RR cursor See Bug #39949. Commit 56c90e29f04727c903bd0f084d23bf44eb1a0a11 caused xrandr scaling and panning options to have cursor issues. For scaling, there could be a dead area of screen when scaling larger than size of mode. For panning, you couldn't pan bigger than mode. When returning bounds, account for panning and scaling. Signed-off-by: Chris Bagwell --- This is an RFC for Bug #39949. It does fix the issue but there may be better ways to solve. randr/rrcrtc.c | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 36caa58..d3df98a 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -282,20 +282,36 @@ RRCrtcPendingProperties(RRCrtcPtr crtc) static void crtc_bounds(RRCrtcPtr crtc, int *left, int *right, int *top, int *bottom) { + int width, height; + BoxRec panned_area; + ScreenPtr pScreen = crtc->pScreen; + rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); + *left = crtc->x; *top = crtc->y; + if (pScrPriv->rrGetPanning && + pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && + (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) + { + width = panned_area.x2 - panned_area.x1; + height = panned_area.y2 - panned_area.y1; + } + else { + RRCrtcGetScanoutSize(crtc, &width, &height); + } + switch (crtc->rotation) { case RR_Rotate_0: case RR_Rotate_180: default: - *right = crtc->x + crtc->mode->mode.width; - *bottom = crtc->y + crtc->mode->mode.height; + *right = crtc->x + width; + *bottom = crtc->y + height; return; case RR_Rotate_90: case RR_Rotate_270: - *right = crtc->x + crtc->mode->mode.height; - *bottom = crtc->y + crtc->mode->mode.width; + *right = crtc->x + height; + *bottom = crtc->y + width; return; } } -- 1.7.7.6