RandR working with old clients and old API.

This commit is contained in:
Keith Packard 2006-09-18 12:18:22 -07:00 committed by Keith Packard
parent db4576798e
commit 0b22ab2f49
6 changed files with 62 additions and 5 deletions

View File

@ -477,6 +477,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
if (!output)
return;
RROutputSetCrtcs (output, &crtc, 1);
RROutputSetCrtc (output, crtc);
RROutputSetConnection (output, RR_Connected);
}
@ -552,7 +553,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
/* notice current mode */
if (newMode)
RRCrtcSet (output->crtc, newMode, 0, 0, pScrPriv->rotation,
RRCrtcNotify (output->crtc, newMode, 0, 0, pScrPriv->rotation,
1, &output);
}
#endif

View File

@ -482,6 +482,9 @@ RROutputSetCrtcs (RROutputPtr output,
RRCrtcPtr *crtcs,
int numCrtcs);
void
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc);
Bool
RROutputSetConnection (RROutputPtr output,
CARD8 connection);

View File

@ -59,7 +59,13 @@ RRCrtcCreate (ScreenPtr pScreen,
crtc->numOutputs = 0;
crtc->changed = TRUE;
crtc->devPrivate = devPrivate;
if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
return NULL;
pScrPriv->crtcs = crtcs;
pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
pScrPriv->changed = TRUE;
return crtc;
}
@ -165,6 +171,16 @@ RRCrtcSet (RRCrtcPtr crtc,
ScreenPtr pScreen = crtc->pScreen;
rrScrPriv(pScreen);
/* See if nothing changed */
if (crtc->mode == mode &&
crtc->x == x &&
crtc->y == y &&
crtc->rotation == rotation &&
crtc->numOutputs == numOutputs &&
!memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)))
{
return TRUE;
}
#if RANDR_12_INTERFACE
if (pScrPriv->rrCrtcSet)
{

View File

@ -824,7 +824,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
if (!crtc)
{
client->errorValue = stuff->crtc;
return RRErrorBase + BadCrtc;
return RRErrorBase + BadRRCrtc;
}
if (stuff->mode == None)
{
@ -838,7 +838,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
if (!mode)
{
client->errorValue = stuff->mode;
return RRErrorBase + BadMode;
return RRErrorBase + BadRRMode;
}
if (numOutputs == 0)
return BadMatch;
@ -854,7 +854,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
if (!outputs[i])
{
client->errorValue = outputIds[i];
return RRErrorBase + BadOutput;
return RRErrorBase + BadRROutput;
}
/* validate crtc for this output */
for (j = 0; j < outputs[i]->numCrtcs; j++)

View File

@ -32,6 +32,7 @@ RRModeGet (ScreenPtr pScreen,
rrScrPriv (pScreen);
int i;
RRModePtr mode;
RRModePtr *modes;
for (i = 0; i < pScrPriv->numModes; i++)
{
@ -43,16 +44,34 @@ RRModeGet (ScreenPtr pScreen,
return mode;
}
}
mode = xalloc (sizeof (RRModeRec) + modeInfo->nameLength + 1);
if (!mode)
return NULL;
mode->refcnt = 1;
mode->mode = *modeInfo;
mode->name = (char *) (mode + 1);
memcpy (mode->name, name, modeInfo->nameLength);
mode->name[modeInfo->nameLength] = '\0';
if (pScrPriv->numModes)
modes = xrealloc (pScrPriv->modes,
(pScrPriv->numModes + 1) * sizeof (RRModePtr));
else
modes = xalloc (sizeof (RRModePtr));
if (!modes)
{
xfree (mode);
return NULL;
}
mode->id = FakeClientID(0);
if (!AddResource (mode->id, RRModeType, (pointer) mode))
return NULL;
++mode->refcnt;
pScrPriv->modes = modes;
pScrPriv->modes[pScrPriv->numModes++] = mode;
pScrPriv->changed = TRUE;
return mode;
}

View File

@ -56,6 +56,7 @@ RROutputCreate (ScreenPtr pScreen,
output->name = (char *) (output + 1);
output->nameLength = nameLength;
memcpy (output->name, name, nameLength);
output->name[nameLength] = '\0';
output->connection = RR_UnknownConnection;
output->subpixelOrder = SubPixelUnknown;
output->crtc = NULL;
@ -67,7 +68,13 @@ RROutputCreate (ScreenPtr pScreen,
output->modes = NULL;
output->changed = TRUE;
output->devPrivate = devPrivate;
if (!AddResource (output->id, RROutputType, (pointer) output))
return NULL;
pScrPriv->outputs = outputs;
pScrPriv->outputs[pScrPriv->numOutputs++] = output;
pScrPriv->changed = TRUE;
return output;
}
@ -89,6 +96,7 @@ RROutputSetClones (RROutputPtr output,
memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
output->clones = newClones;
output->numClones = numClones;
output->changed = TRUE;
return TRUE;
}
@ -107,6 +115,7 @@ RROutputSetModes (RROutputPtr output,
memcpy (newModes, modes, numModes * sizeof (RRModePtr));
output->modes = newModes;
output->numModes = numModes;
output->changed = TRUE;
return TRUE;
}
@ -125,14 +134,23 @@ RROutputSetCrtcs (RROutputPtr output,
memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
output->crtcs = newCrtcs;
output->numCrtcs = numCrtcs;
output->changed = TRUE;
return TRUE;
}
void
RROutputSetCrtc (RROutputPtr output, RRCrtcPtr crtc)
{
output->crtc = crtc;
output->changed = TRUE;
}
Bool
RROutputSetConnection (RROutputPtr output,
CARD8 connection)
{
output->connection = connection;
output->changed = TRUE;
return TRUE;
}