Use RRScreenSetSizeRange in 1.0 compat. Check RRGetInfo for error.

The RRScreenSizeSetRange function is used externally for 1.2 API drivers,
but can also be used in the 1.0 compatibility code. This also ensures that
the right changed bits are set so that clients are correctly notified when
the range changes.

RRGetInfo can return an error, use that to return BadAlloc to clients
instead of blindly going on with various requests.
(cherry picked from f05dd384d3 commit)
This commit is contained in:
Keith Packard 2006-12-30 21:52:22 -08:00 committed by Dave Airlie
parent dc5eb45232
commit e79602fca2
2 changed files with 15 additions and 17 deletions

View File

@ -169,18 +169,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
if (height > maxHeight) maxHeight = height;
}
if (minWidth != pScrPriv->minWidth) {
pScrPriv->minWidth = minWidth; pScrPriv->changed = TRUE;
}
if (maxWidth != pScrPriv->maxWidth) {
pScrPriv->maxWidth = maxWidth; pScrPriv->changed = TRUE;
}
if (minHeight != pScrPriv->minHeight) {
pScrPriv->minHeight = minHeight; pScrPriv->changed = TRUE;
}
if (maxHeight != pScrPriv->maxHeight) {
pScrPriv->maxHeight = maxHeight; pScrPriv->changed = TRUE;
}
RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight);
/* notice current mode */
if (newMode)
@ -219,7 +208,6 @@ RRGetInfo (ScreenPtr pScreen)
return TRUE;
}
#if RANDR_12_INTERFACE
/*
* Register the range of sizes for the screen
*/
@ -234,12 +222,19 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
if (!pScrPriv)
return;
if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight &&
pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight)
{
return;
}
pScrPriv->minWidth = minWidth;
pScrPriv->minHeight = minHeight;
pScrPriv->maxWidth = maxWidth;
pScrPriv->maxHeight = maxHeight;
pScrPriv->changed = TRUE;
pScrPriv->configChanged = TRUE;
}
#endif
#ifdef RANDR_10_INTERFACE
static Bool

View File

@ -234,7 +234,8 @@ ProcRRGetScreenSizeRange (ClientPtr client)
if (pScrPriv)
{
RRGetInfo (pScreen);
if (!RRGetInfo (pScreen))
return BadAlloc;
rep.minWidth = pScrPriv->minWidth;
rep.minHeight = pScrPriv->minHeight;
rep.maxWidth = pScrPriv->maxWidth;
@ -349,7 +350,8 @@ ProcRRGetScreenResources (ClientPtr client)
rep.pad = 0;
if (pScrPriv)
RRGetInfo (pScreen);
if (!RRGetInfo (pScreen))
return BadAlloc;
if (!pScrPriv)
{
@ -591,7 +593,8 @@ ProcRRGetScreenInfo (ClientPtr client)
rep.pad = 0;
if (pScrPriv)
RRGetInfo (pScreen);
if (!RRGetInfo (pScreen))
return BadAlloc;
output = RRFirstOutput (pScreen);