RandR: Fix failure handling (Closes #4635; Thomas Winischhofer)
This commit is contained in:
parent
4608a2b654
commit
b5ce065a5e
|
@ -134,6 +134,7 @@ xf86RandRSetMode (ScreenPtr pScreen,
|
||||||
int oldmmWidth = pScreen->mmWidth;
|
int oldmmWidth = pScreen->mmWidth;
|
||||||
int oldmmHeight = pScreen->mmHeight;
|
int oldmmHeight = pScreen->mmHeight;
|
||||||
WindowPtr pRoot = WindowTable[pScreen->myNum];
|
WindowPtr pRoot = WindowTable[pScreen->myNum];
|
||||||
|
Bool ret = TRUE;
|
||||||
|
|
||||||
if (pRoot)
|
if (pRoot)
|
||||||
(*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
|
(*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
|
||||||
|
@ -168,7 +169,7 @@ xf86RandRSetMode (ScreenPtr pScreen,
|
||||||
scrp->virtualY = pScreen->height = oldHeight;
|
scrp->virtualY = pScreen->height = oldHeight;
|
||||||
pScreen->mmWidth = oldmmWidth;
|
pScreen->mmWidth = oldmmWidth;
|
||||||
pScreen->mmHeight = oldmmHeight;
|
pScreen->mmHeight = oldmmHeight;
|
||||||
return FALSE;
|
ret = FALSE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Make sure the layout is correct
|
* Make sure the layout is correct
|
||||||
|
@ -182,7 +183,7 @@ xf86RandRSetMode (ScreenPtr pScreen,
|
||||||
xf86SetViewport (pScreen, 0, 0);
|
xf86SetViewport (pScreen, 0, 0);
|
||||||
if (pRoot)
|
if (pRoot)
|
||||||
(*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
|
(*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
@ -196,6 +197,7 @@ xf86RandRSetConfig (ScreenPtr pScreen,
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
int px, py;
|
int px, py;
|
||||||
Bool useVirtual = FALSE;
|
Bool useVirtual = FALSE;
|
||||||
|
Rotation oldRotation = randrp->rotation;
|
||||||
|
|
||||||
miPointerPosition (&px, &py);
|
miPointerPosition (&px, &py);
|
||||||
for (mode = scrp->modes; ; mode = mode->next)
|
for (mode = scrp->modes; ; mode = mode->next)
|
||||||
|
@ -219,7 +221,7 @@ xf86RandRSetConfig (ScreenPtr pScreen,
|
||||||
|
|
||||||
if (randrp->rotation != rotation) {
|
if (randrp->rotation != rotation) {
|
||||||
|
|
||||||
/* Have the driver do its thing. */
|
/* Have the driver do its thing. */
|
||||||
if (scrp->DriverFunc) {
|
if (scrp->DriverFunc) {
|
||||||
xorgRRRotation RRRotation;
|
xorgRRRotation RRRotation;
|
||||||
RRRotation.RRConfig.rotation = rotation;
|
RRRotation.RRConfig.rotation = rotation;
|
||||||
|
@ -238,8 +240,22 @@ xf86RandRSetConfig (ScreenPtr pScreen,
|
||||||
randrp->rotation = rotation;
|
randrp->rotation = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight))
|
if (!xf86RandRSetMode (pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) {
|
||||||
|
if(randrp->rotation != oldRotation) {
|
||||||
|
/* Have the driver undo its thing. */
|
||||||
|
if (scrp->DriverFunc) {
|
||||||
|
xorgRRRotation RRRotation;
|
||||||
|
RRRotation.RRConfig.rotation = oldRotation;
|
||||||
|
RRRotation.RRConfig.rate = xf86RandRModeRefresh (scrp->currentMode);
|
||||||
|
RRRotation.RRConfig.width = pScreen->width;
|
||||||
|
RRRotation.RRConfig.height = pScreen->height;
|
||||||
|
(*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
randrp->rotation = oldRotation;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Move the cursor back where it belongs; SwitchMode repositions it
|
* Move the cursor back where it belongs; SwitchMode repositions it
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue