#Bug 780: add RRSetScreenConfig
This commit is contained in:
parent
f8226cee08
commit
c5ab3fdd92
105
randr/randr.c
105
randr/randr.c
|
@ -719,7 +719,7 @@ ProcRRSetScreenConfig (ClientPtr client)
|
||||||
|
|
||||||
pScreen = pDraw->pScreen;
|
pScreen = pDraw->pScreen;
|
||||||
|
|
||||||
pScrPriv= rrGetScrPriv(pScreen);
|
pScrPriv = rrGetScrPriv(pScreen);
|
||||||
|
|
||||||
time = ClientTimeToServerTime(stuff->timestamp);
|
time = ClientTimeToServerTime(stuff->timestamp);
|
||||||
configTime = ClientTimeToServerTime(stuff->configTimestamp);
|
configTime = ClientTimeToServerTime(stuff->configTimestamp);
|
||||||
|
@ -900,6 +900,109 @@ sendReply:
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
RRSetScreenConfig (ScreenPtr pScreen,
|
||||||
|
Rotation rotation,
|
||||||
|
int rate,
|
||||||
|
RRScreenSizePtr pSize)
|
||||||
|
{
|
||||||
|
rrScrPrivPtr pScrPriv;
|
||||||
|
int i;
|
||||||
|
short oldWidth, oldHeight;
|
||||||
|
|
||||||
|
pScrPriv = rrGetScrPriv(pScreen);
|
||||||
|
|
||||||
|
oldWidth = pScreen->width;
|
||||||
|
oldHeight = pScreen->height;
|
||||||
|
|
||||||
|
if (!RRGetInfo (pScreen))
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validate requested rotation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* test the rotation bits only! */
|
||||||
|
switch (rotation & 0xf) {
|
||||||
|
case RR_Rotate_0:
|
||||||
|
case RR_Rotate_90:
|
||||||
|
case RR_Rotate_180:
|
||||||
|
case RR_Rotate_270:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/*
|
||||||
|
* Invalid rotation
|
||||||
|
*/
|
||||||
|
return BadValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((~pScrPriv->rotations) & rotation)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* requested rotation or reflection not supported by screen
|
||||||
|
*/
|
||||||
|
return BadMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validate requested refresh
|
||||||
|
*/
|
||||||
|
if (rate)
|
||||||
|
{
|
||||||
|
for (i = 0; i < pSize->nRates; i++)
|
||||||
|
{
|
||||||
|
RRScreenRatePtr pRate = &pSize->pRates[i];
|
||||||
|
if (pRate->referenced && pRate->rate == rate)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == pSize->nRates)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Invalid rate
|
||||||
|
*/
|
||||||
|
return BadValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call out to ddx routine to effect the change
|
||||||
|
*/
|
||||||
|
if (!(*pScrPriv->rrSetConfig) (pScreen, rotation, rate,
|
||||||
|
pSize))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* unknown DDX failure, report to client
|
||||||
|
*/
|
||||||
|
return BadImplementation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set current extension configuration pointers
|
||||||
|
*/
|
||||||
|
RRSetCurrentConfig (pScreen, rotation, rate, pSize);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deliver ScreenChangeNotify events whenever
|
||||||
|
* the configuration is updated
|
||||||
|
*/
|
||||||
|
WalkTree (pScreen, TellChanged, (pointer) pScreen);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deliver ConfigureNotify events when root changes
|
||||||
|
* pixel size
|
||||||
|
*/
|
||||||
|
if (oldWidth != pScreen->width || oldHeight != pScreen->height)
|
||||||
|
RRSendConfigNotify (pScreen);
|
||||||
|
RREditConnectionInfo (pScreen);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fix pointer bounds and location
|
||||||
|
*/
|
||||||
|
ScreenRestructured (pScreen);
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcRRSelectInput (ClientPtr client)
|
ProcRRSelectInput (ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,6 +114,12 @@ RRSetCurrentConfig (ScreenPtr pScreen,
|
||||||
|
|
||||||
Bool RRScreenInit(ScreenPtr pScreen);
|
Bool RRScreenInit(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
int
|
||||||
|
RRSetScreenConfig (ScreenPtr pScreen,
|
||||||
|
Rotation rotation,
|
||||||
|
int rate,
|
||||||
|
RRScreenSizePtr pSize);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
miRandRInit (ScreenPtr pScreen);
|
miRandRInit (ScreenPtr pScreen);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue