Add RRInit function to create resource types for RR objects.

To allow RandR objects to be created before the screen object exists,
the resource types must be registered with the resource database.
A driver wishing to create RandR objects must call RRInit before doing so.

Also, fix a segfault when setting Output data before it is associated with a
screen.
This commit is contained in:
Keith Packard
2006-11-08 23:17:55 -08:00
parent ec77a95a02
commit 0dee48b8af
3 changed files with 41 additions and 18 deletions

View File

@@ -31,10 +31,13 @@ void
RROutputChanged (RROutputPtr output)
{
ScreenPtr pScreen = output->pScreen;
rrScrPriv (pScreen);
output->changed = TRUE;
pScrPriv->changed = TRUE;
if (pScreen)
{
rrScrPriv (pScreen);
pScrPriv->changed = TRUE;
}
}
/*
@@ -335,17 +338,21 @@ RROutputDestroyResource (pointer value, XID pid)
{
RROutputPtr output = (RROutputPtr) value;
ScreenPtr pScreen = output->pScreen;
rrScrPriv(pScreen);
int i;
for (i = 0; i < pScrPriv->numOutputs; i++)
if (pScreen)
{
if (pScrPriv->outputs[i] == output)
rrScrPriv(pScreen);
int i;
for (i = 0; i < pScrPriv->numOutputs; i++)
{
memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
(pScrPriv->numOutputs - (i - 1)) * sizeof (RROutputPtr));
--pScrPriv->numOutputs;
break;
if (pScrPriv->outputs[i] == output)
{
memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
(pScrPriv->numOutputs - (i - 1)) * sizeof (RROutputPtr));
--pScrPriv->numOutputs;
break;
}
}
}
if (output->modes)
@@ -481,4 +488,3 @@ ProcRRGetOutputInfo (ClientPtr client)
return client->noClientException;
}