diff options
author | Matthias Hopf <mhopf@suse.de> | 2008-12-04 16:28:40 +0100 |
---|---|---|
committer | Matthias Hopf <mhopf@suse.de> | 2008-12-04 18:16:43 +0100 |
commit | 219c26ce0c65625d55cfd943ec66fe94a1a0ddfd (patch) | |
tree | 5fcc7e2a182627a44438b0f1e8d7c646d818b94e /hw | |
parent | 18a8bac1a1567b6215928f96870554ea63f39aab (diff) |
randr: Don't change panning parameters if verification fails.
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 3745f4fbb..8ef4ebe3d 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -1327,20 +1327,35 @@ xf86RandR13SetPanning (ScreenPtr pScreen, { XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); xf86CrtcPtr crtc = randr_crtc->devPrivate; - int ret; + BoxRec oldTotalArea; + BoxRec oldTrackingArea; + INT16 oldBorder[4]; + if (crtc->version < 2) return FALSE; + + memcpy (&oldTotalArea, &crtc->panningTotalArea, sizeof(BoxRec)); + memcpy (&oldTrackingArea, &crtc->panningTrackingArea, sizeof(BoxRec)); + memcpy (oldBorder, crtc->panningBorder, 4*sizeof(INT16)); + if (totalArea) memcpy (&crtc->panningTotalArea, totalArea, sizeof(BoxRec)); if (trackingArea) memcpy (&crtc->panningTrackingArea, trackingArea, sizeof(BoxRec)); if (border) memcpy (crtc->panningBorder, border, 4*sizeof(INT16)); - ret = xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height); - xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY); - return ret; + if (xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height)) { + xf86RandR13Pan (crtc, randrp->pointerX, randrp->pointerY); + return TRUE; + } else { + /* Restore old settings */ + memcpy (&crtc->panningTotalArea, &oldTotalArea, sizeof(BoxRec)); + memcpy (&crtc->panningTrackingArea, &oldTrackingArea, sizeof(BoxRec)); + memcpy (crtc->panningBorder, oldBorder, 4*sizeof(INT16)); + return FALSE; + } } static Bool |