devPrivates rework: since API is already broken, switch everything
over to new system. Need to update documentation and address some remaining vestiges of old system such as CursorRec structure, fb "offman" structure, and FontRec privates.
This commit is contained in:
parent
8554707326
commit
4017d31902
|
@ -48,5 +48,5 @@ int DPMSGet(int *plevel)
|
|||
|
||||
int DPMSSet(ClientPtr client, int level)
|
||||
{
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ static void PanoramiXResetProc(ExtensionEntry*);
|
|||
|
||||
int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
|
||||
|
||||
static int PanoramiXGCIndex = -1;
|
||||
static int PanoramiXScreenIndex = -1;
|
||||
static DevPrivateKey PanoramiXGCKey = &PanoramiXGCKey;
|
||||
static DevPrivateKey PanoramiXScreenKey = &PanoramiXScreenKey;
|
||||
|
||||
typedef struct {
|
||||
DDXPointRec clipOrg;
|
||||
|
@ -140,8 +140,8 @@ static GCFuncs XineramaGCFuncs = {
|
|||
};
|
||||
|
||||
#define Xinerama_GC_FUNC_PROLOGUE(pGC)\
|
||||
PanoramiXGCPtr pGCPriv = \
|
||||
(PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\
|
||||
PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr) \
|
||||
dixLookupPrivate(&(pGC)->devPrivates, PanoramiXGCKey); \
|
||||
(pGC)->funcs = pGCPriv->wrapFuncs;
|
||||
|
||||
#define Xinerama_GC_FUNC_EPILOGUE(pGC)\
|
||||
|
@ -152,8 +152,8 @@ static GCFuncs XineramaGCFuncs = {
|
|||
static Bool
|
||||
XineramaCloseScreen (int i, ScreenPtr pScreen)
|
||||
{
|
||||
PanoramiXScreenPtr pScreenPriv =
|
||||
(PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
|
||||
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
|
||||
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
|
||||
|
||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||
pScreen->CreateGC = pScreenPriv->CreateGC;
|
||||
|
@ -171,14 +171,14 @@ static Bool
|
|||
XineramaCreateGC(GCPtr pGC)
|
||||
{
|
||||
ScreenPtr pScreen = pGC->pScreen;
|
||||
PanoramiXScreenPtr pScreenPriv =
|
||||
(PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
|
||||
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
|
||||
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
|
||||
Bool ret;
|
||||
|
||||
pScreen->CreateGC = pScreenPriv->CreateGC;
|
||||
if((ret = (*pScreen->CreateGC)(pGC))) {
|
||||
PanoramiXGCPtr pGCPriv =
|
||||
(PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr;
|
||||
PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr)
|
||||
dixLookupPrivate(&pGC->devPrivates, PanoramiXGCKey);
|
||||
|
||||
pGCPriv->wrapFuncs = pGC->funcs;
|
||||
pGC->funcs = &XineramaGCFuncs;
|
||||
|
@ -284,8 +284,8 @@ XineramaCopyGC (
|
|||
unsigned long mask,
|
||||
GCPtr pGCDst
|
||||
){
|
||||
PanoramiXGCPtr pSrcPriv =
|
||||
(PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr;
|
||||
PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
|
||||
dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
|
||||
Xinerama_GC_FUNC_PROLOGUE (pGCDst);
|
||||
|
||||
if(mask & GCTileStipXOrigin)
|
||||
|
@ -484,20 +484,17 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
|||
xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
|
||||
|
||||
BREAK_IF(!panoramiXdataPtr);
|
||||
BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
|
||||
BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0);
|
||||
|
||||
if (!dixRequestPrivate(PanoramiXGCKey, sizeof(PanoramiXGCRec))) {
|
||||
noPanoramiXExtension = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < PanoramiXNumScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex,
|
||||
sizeof(PanoramiXGCRec))) {
|
||||
noPanoramiXExtension = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
|
||||
pScreen->devPrivates[PanoramiXScreenIndex].ptr =
|
||||
(pointer)pScreenPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
|
||||
pScreenPriv);
|
||||
if(!pScreenPriv) {
|
||||
noPanoramiXExtension = TRUE;
|
||||
return;
|
||||
|
|
11
Xext/saver.c
11
Xext/saver.c
|
@ -234,10 +234,12 @@ MakeScreenPrivate (
|
|||
ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static int ScreenPrivateIndex;
|
||||
static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey;
|
||||
|
||||
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
|
||||
#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
|
||||
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
|
||||
dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
|
||||
#define SetScreenPrivate(s,v) \
|
||||
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
|
||||
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
|
||||
|
||||
#define New(t) ((t *) xalloc (sizeof (t)))
|
||||
|
@ -260,14 +262,13 @@ ScreenSaverExtensionInit(INITARGS)
|
|||
AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
|
||||
EventType = CreateNewResourceType(ScreenSaverFreeEvents);
|
||||
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend);
|
||||
ScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
pScreen = screenInfo.screens[i];
|
||||
SetScreenPrivate (pScreen, NULL);
|
||||
}
|
||||
if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 &&
|
||||
if (AttrType && EventType && SuspendType &&
|
||||
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
|
||||
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
|
||||
ScreenSaverResetProc, StandardMinorOpcode)))
|
||||
|
|
18
Xext/shm.c
18
Xext/shm.c
|
@ -119,7 +119,7 @@ static int pixmapFormat;
|
|||
static int shmPixFormat[MAXSCREENS];
|
||||
static ShmFuncsPtr shmFuncs[MAXSCREENS];
|
||||
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
|
||||
static int shmPixmapPrivate;
|
||||
static DevPrivateKey shmPixmapPrivate = &shmPixmapPrivate;
|
||||
static ShmFuncs miFuncs = {NULL, miShmPutImage};
|
||||
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
|
||||
|
||||
|
@ -229,20 +229,11 @@ ShmExtensionInit(INITARGS)
|
|||
if (!pixmapFormat)
|
||||
pixmapFormat = ZPixmap;
|
||||
if (sharedPixmaps)
|
||||
{
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
|
||||
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
|
||||
}
|
||||
shmPixmapPrivate = AllocatePixmapPrivateIndex();
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
if (!AllocatePixmapPrivate(screenInfo.screens[i],
|
||||
shmPixmapPrivate, 0))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ShmSegType = CreateNewResourceType(ShmDetachSegment);
|
||||
if (ShmSegType &&
|
||||
|
@ -295,7 +286,8 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
|
|||
if (pPixmap->refcnt == 1)
|
||||
{
|
||||
ShmDescPtr shmdesc;
|
||||
shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
|
||||
shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
|
||||
shmPixmapPrivate);
|
||||
if (shmdesc)
|
||||
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
|
||||
}
|
||||
|
@ -762,7 +754,7 @@ CreatePmap:
|
|||
shmdesc->addr + stuff->offset);
|
||||
|
||||
if (pMap) {
|
||||
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
|
||||
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
|
||||
shmdesc->refcnt++;
|
||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pMap->drawable.id = newPix->info[j].id;
|
||||
|
@ -1076,7 +1068,7 @@ CreatePmap:
|
|||
shmdesc->addr + stuff->offset);
|
||||
if (pMap)
|
||||
{
|
||||
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
|
||||
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
|
||||
shmdesc->refcnt++;
|
||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pMap->drawable.id = stuff->pid;
|
||||
|
|
19
Xext/xevie.c
19
Xext/xevie.c
|
@ -76,11 +76,11 @@ DeviceIntPtr xeviemouse = NULL;
|
|||
Mask xevieMask = 0;
|
||||
int xevieEventSent = 0;
|
||||
int xevieKBEventSent = 0;
|
||||
static unsigned int xevieServerGeneration;
|
||||
static int xevieDevicePrivateIndex;
|
||||
static DevPrivateKey xevieDevicePrivateKey = &xevieDevicePrivateKey;
|
||||
static Bool xevieModifiersOn = FALSE;
|
||||
|
||||
#define XEVIEINFO(dev) ((xevieDeviceInfoPtr)dev->devPrivates[xevieDevicePrivateIndex].ptr)
|
||||
#define XEVIEINFO(dev) ((xevieDeviceInfoPtr) \
|
||||
dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey))
|
||||
|
||||
Mask xevieFilters[128] =
|
||||
{
|
||||
|
@ -134,12 +134,6 @@ XevieExtensionInit (void)
|
|||
{
|
||||
ExtensionEntry* extEntry;
|
||||
|
||||
if (serverGeneration != xevieServerGeneration) {
|
||||
if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
|
||||
return;
|
||||
xevieServerGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
|
||||
return;
|
||||
|
||||
|
@ -618,14 +612,11 @@ XevieAdd(DeviceIntPtr device, void* data)
|
|||
{
|
||||
xevieDeviceInfoPtr xeviep;
|
||||
|
||||
if (!AllocateDevicePrivate(device, xevieDevicePrivateIndex))
|
||||
return FALSE;
|
||||
|
||||
xeviep = xalloc (sizeof (xevieDeviceInfoRec));
|
||||
if (!xeviep)
|
||||
return FALSE;
|
||||
|
||||
device->devPrivates[xevieDevicePrivateIndex].ptr = xeviep;
|
||||
dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, xeviep);
|
||||
XevieUnwrapAdd(device, data);
|
||||
|
||||
return TRUE;
|
||||
|
@ -642,7 +633,7 @@ XevieRemove(DeviceIntPtr device,pointer data)
|
|||
UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
|
||||
|
||||
xfree(xeviep);
|
||||
device->devPrivates[xevieDevicePrivateIndex].ptr = NULL;
|
||||
dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
171
Xext/xprint.c
171
Xext/xprint.c
|
@ -153,8 +153,6 @@ static int XpFreePage(pointer, XID);
|
|||
static Bool XpCloseScreen(int, ScreenPtr);
|
||||
static CARD32 GetAllEventMasks(XpContextPtr);
|
||||
static struct _XpClient *CreateXpClient(ClientPtr);
|
||||
static void InitContextPrivates(XpContextPtr);
|
||||
static void ResetContextPrivates(void);
|
||||
static struct _XpClient *FindClient(XpContextPtr, ClientPtr);
|
||||
static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr);
|
||||
|
||||
|
@ -233,21 +231,12 @@ static XpScreenPtr XpScreens[MAXSCREENS];
|
|||
static unsigned char XpReqCode;
|
||||
static int XpEventBase;
|
||||
static int XpErrorBase;
|
||||
static unsigned long XpGeneration = 0;
|
||||
static int XpClientPrivateIndex;
|
||||
static DevPrivateKey XpClientPrivateKey = &XpClientPrivateKey;
|
||||
|
||||
/* Variables for the context private machinery.
|
||||
* These must be initialized at compile time because
|
||||
* main() calls InitOutput before InitExtensions, and the
|
||||
* output drivers are likely to call AllocateContextPrivate.
|
||||
* These variables are reset at CloseScreen time. CloseScreen
|
||||
* is used because it occurs after FreeAllResources, and before
|
||||
* the next InitOutput cycle.
|
||||
*/
|
||||
static int contextPrivateCount = 0;
|
||||
static int contextPrivateLen = 0;
|
||||
static unsigned *contextPrivateSizes = (unsigned *)NULL;
|
||||
static unsigned totalContextSize = sizeof(XpContextRec);
|
||||
#define XP_GETPRIV(pClient) ((XpContextPtr) \
|
||||
dixLookupPrivate(&(pClient)->devPrivates, XpClientPrivateKey))
|
||||
#define XP_SETPRIV(pClient, p) \
|
||||
dixSetPrivate(&(pClient)->devPrivates, XpClientPrivateKey, p)
|
||||
|
||||
/*
|
||||
* There are three types of resources involved. One is the resource associated
|
||||
|
@ -305,20 +294,6 @@ XpExtensionInit(INITARGS)
|
|||
EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent;
|
||||
}
|
||||
|
||||
if(XpGeneration != serverGeneration)
|
||||
{
|
||||
XpClientPrivateIndex = AllocateClientPrivateIndex();
|
||||
/*
|
||||
* We allocate 0 length & simply stuff a pointer to the
|
||||
* ContextRec in the DevUnion.
|
||||
*/
|
||||
if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE)
|
||||
{
|
||||
/* we can't alloc a client private, should we bail??? XXX */
|
||||
}
|
||||
XpGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXSCREENS; i++)
|
||||
{
|
||||
/*
|
||||
|
@ -377,14 +352,6 @@ XpCloseScreen(int index, ScreenPtr pScreen)
|
|||
}
|
||||
XpScreens[index] = (XpScreenPtr)NULL;
|
||||
|
||||
/*
|
||||
* It's wasteful to call ResetContextPrivates() at every CloseScreen,
|
||||
* but it's the best we know how to do for now. We do this because we
|
||||
* have to wait until after all resources have been freed (so we know
|
||||
* how to free the ContextRecs), and before the next InitOutput cycle.
|
||||
* See dix/main.c for the order of initialization and reset.
|
||||
*/
|
||||
ResetContextPrivates();
|
||||
return (*CloseScreen)(index, pScreen);
|
||||
}
|
||||
|
||||
|
@ -956,12 +923,10 @@ ProcXpCreateContext(ClientPtr client)
|
|||
/*
|
||||
* Allocate and add the context resource.
|
||||
*/
|
||||
if((pContext = (XpContextPtr) xalloc(totalContextSize)) ==
|
||||
if((pContext = (XpContextPtr) xalloc(sizeof(XpContextRec))) ==
|
||||
(XpContextPtr) NULL)
|
||||
return BadAlloc;
|
||||
|
||||
InitContextPrivates(pContext);
|
||||
|
||||
if(AddResource(stuff->contextID, RTcontext, (pointer) pContext)
|
||||
!= TRUE)
|
||||
{
|
||||
|
@ -975,6 +940,7 @@ ProcXpCreateContext(ClientPtr client)
|
|||
pContext->state = 0;
|
||||
pContext->clientSlept = (ClientPtr)NULL;
|
||||
pContext->imageRes = 0;
|
||||
pContext->devPrivates = NULL;
|
||||
|
||||
pContext->funcs.DestroyContext = 0;
|
||||
pContext->funcs.StartJob = 0;
|
||||
|
@ -1041,8 +1007,7 @@ ProcXpSetContext(ClientPtr client)
|
|||
|
||||
REQUEST_AT_LEAST_SIZE(xPrintSetContextReq);
|
||||
|
||||
if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) !=
|
||||
(pointer)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) != (pointer)NULL)
|
||||
{
|
||||
/*
|
||||
* Erase this client's knowledge of its old context, if any.
|
||||
|
@ -1055,7 +1020,7 @@ ProcXpSetContext(ClientPtr client)
|
|||
FreeXpClient(pPrintClient, TRUE);
|
||||
}
|
||||
|
||||
client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL;
|
||||
XP_SETPRIV(client, NULL);
|
||||
}
|
||||
if(stuff->printContext == None)
|
||||
return Success;
|
||||
|
@ -1077,7 +1042,7 @@ ProcXpSetContext(ClientPtr client)
|
|||
if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
|
||||
return BadAlloc;
|
||||
|
||||
client->devPrivates[XpClientPrivateIndex].ptr = pContext;
|
||||
XP_SETPRIV(client, pContext);
|
||||
|
||||
XpSetFontResFunc(client);
|
||||
|
||||
|
@ -1090,7 +1055,7 @@ ProcXpSetContext(ClientPtr client)
|
|||
XpContextPtr
|
||||
XpGetPrintContext(ClientPtr client)
|
||||
{
|
||||
return (client->devPrivates[XpClientPrivateIndex].ptr);
|
||||
return XP_GETPRIV(client);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1105,8 +1070,7 @@ ProcXpGetContext(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xPrintGetContextReq);
|
||||
|
||||
if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) ==
|
||||
(pointer)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (pointer)NULL)
|
||||
rep.printContext = None;
|
||||
else
|
||||
rep.printContext = pContext->contextID;
|
||||
|
@ -1249,6 +1213,7 @@ XpFreeContext(pointer data, XID id)
|
|||
}
|
||||
|
||||
xfree(pContext->printerName);
|
||||
dixFreePrivates(pContext->devPrivates);
|
||||
xfree(pContext);
|
||||
return Success; /* ??? */
|
||||
}
|
||||
|
@ -1284,11 +1249,9 @@ FreeXpClient(XpClientPtr pXpClient, Bool freeResource)
|
|||
* If we're freeing the clientRec associated with the context tied
|
||||
* to the client's devPrivates, then we need to clear the devPrivates.
|
||||
*/
|
||||
if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr ==
|
||||
pXpClient->context)
|
||||
if(XP_GETPRIV(pXpClient->client) == pXpClient->context)
|
||||
{
|
||||
pXpClient->client->devPrivates[XpClientPrivateIndex].ptr =
|
||||
(pointer)NULL;
|
||||
XP_SETPRIV(pXpClient->client, NULL);
|
||||
}
|
||||
|
||||
for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead;
|
||||
|
@ -1372,87 +1335,6 @@ XpFreePage(pointer data, XID id)
|
|||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* ContextPrivate machinery.
|
||||
* Context privates are intended for use by the drivers, allowing the
|
||||
* drivers to maintain context-specific data. The driver should free
|
||||
* the associated data at DestroyContext time.
|
||||
*/
|
||||
|
||||
static void
|
||||
InitContextPrivates(XpContextPtr context)
|
||||
{
|
||||
register char *ptr;
|
||||
DevUnion *ppriv;
|
||||
register unsigned *sizes;
|
||||
register unsigned size;
|
||||
register int i;
|
||||
|
||||
if (totalContextSize == sizeof(XpContextRec))
|
||||
ppriv = (DevUnion *)NULL;
|
||||
else
|
||||
ppriv = (DevUnion *)(context + 1);
|
||||
|
||||
context->devPrivates = ppriv;
|
||||
sizes = contextPrivateSizes;
|
||||
ptr = (char *)(ppriv + contextPrivateLen);
|
||||
for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ( (size = *sizes) )
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ResetContextPrivates(void)
|
||||
{
|
||||
contextPrivateCount = 0;
|
||||
contextPrivateLen = 0;
|
||||
xfree(contextPrivateSizes);
|
||||
contextPrivateSizes = (unsigned *)NULL;
|
||||
totalContextSize = sizeof(XpContextRec);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
XpAllocateContextPrivateIndex(void)
|
||||
{
|
||||
return contextPrivateCount++;
|
||||
}
|
||||
|
||||
Bool
|
||||
XpAllocateContextPrivate(int index, unsigned amount)
|
||||
{
|
||||
unsigned oldamount;
|
||||
|
||||
if (index >= contextPrivateLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(contextPrivateSizes,
|
||||
(index + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
return FALSE;
|
||||
while (contextPrivateLen <= index)
|
||||
{
|
||||
nsizes[contextPrivateLen++] = 0;
|
||||
totalContextSize += sizeof(DevUnion);
|
||||
}
|
||||
contextPrivateSizes = nsizes;
|
||||
}
|
||||
oldamount = contextPrivateSizes[index];
|
||||
if (amount > oldamount)
|
||||
{
|
||||
contextPrivateSizes[index] = amount;
|
||||
totalContextSize += (amount - oldamount);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static XpClientPtr
|
||||
AcquireClient(XpContextPtr pContext, ClientPtr client)
|
||||
{
|
||||
|
@ -1501,8 +1383,7 @@ ProcXpStartJob(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xPrintStartJobReq);
|
||||
|
||||
/* Check to see that a context has been established by this client. */
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadContext;
|
||||
|
||||
if(pContext->state != 0)
|
||||
|
@ -1542,8 +1423,7 @@ ProcXpEndJob(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xPrintEndJobReq);
|
||||
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadSequence;
|
||||
|
||||
if(!(pContext->state & JOB_STARTED))
|
||||
|
@ -1648,8 +1528,7 @@ ProcXpStartDoc(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xPrintStartDocReq);
|
||||
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadSequence;
|
||||
|
||||
if(!(pContext->state & JOB_STARTED) ||
|
||||
|
@ -1684,8 +1563,7 @@ ProcXpEndDoc(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xPrintEndDocReq);
|
||||
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadSequence;
|
||||
|
||||
if(!(pContext->state & DOC_RAW_STARTED) &&
|
||||
|
@ -1837,8 +1715,7 @@ ProcXpStartPage(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xPrintStartPageReq);
|
||||
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadSequence;
|
||||
|
||||
if(!(pContext->state & JOB_STARTED))
|
||||
|
@ -1882,8 +1759,7 @@ ProcXpEndPage(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xPrintEndPageReq);
|
||||
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadSequence;
|
||||
|
||||
if(!(pContext->state & PAGE_STARTED))
|
||||
|
@ -1932,8 +1808,7 @@ ProcXpPutDocumentData(ClientPtr client)
|
|||
|
||||
REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
|
||||
|
||||
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
|
||||
== (XpContextPtr)NULL)
|
||||
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
|
||||
return XpErrorBase+XPBadSequence;
|
||||
|
||||
if(!(pContext->state & DOC_RAW_STARTED) &&
|
||||
|
@ -2443,7 +2318,7 @@ GetAllEventMasks(XpContextPtr pContext)
|
|||
XpContextPtr
|
||||
XpContextOfClient(ClientPtr client)
|
||||
{
|
||||
return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
|
||||
return XP_GETPRIV(client);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -388,8 +388,8 @@ ProcXvQueryAdaptors(ClientPtr client)
|
|||
return rc;
|
||||
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
|
||||
|
||||
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
|
||||
XvGetScreenKey());
|
||||
if (!pxvs)
|
||||
{
|
||||
rep.type = X_Reply;
|
||||
|
@ -2099,7 +2099,8 @@ XineramaXvPutStill(ClientPtr client)
|
|||
void XineramifyXv(void)
|
||||
{
|
||||
ScreenPtr pScreen, screen0 = screenInfo.screens[0];
|
||||
XvScreenPtr xvsp0 = (XvScreenPtr)screen0->devPrivates[XvScreenIndex].ptr;
|
||||
XvScreenPtr xvsp0 = (XvScreenPtr)dixLookupPrivate(&screen0->devPrivates,
|
||||
XvGetScreenKey());
|
||||
XvAdaptorPtr refAdapt, pAdapt;
|
||||
XvAttributePtr pAttr;
|
||||
XvScreenPtr xvsp;
|
||||
|
@ -2132,8 +2133,8 @@ void XineramifyXv(void)
|
|||
|
||||
for(j = 1; j < PanoramiXNumScreens; j++) {
|
||||
pScreen = screenInfo.screens[j];
|
||||
xvsp = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
|
||||
|
||||
xvsp = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
|
||||
XvGetScreenKey());
|
||||
/* Do not try to go on if xv is not supported on this screen */
|
||||
if (xvsp==NULL) continue ;
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ SOFTWARE.
|
|||
#include "scrnintstr.h"
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
|
||||
extern int XvScreenIndex;
|
||||
extern unsigned long XvExtensionGeneration;
|
||||
extern unsigned long XvScreenGeneration;
|
||||
extern unsigned long XvResourceGeneration;
|
||||
|
@ -224,10 +223,8 @@ typedef struct {
|
|||
DevUnion devPriv;
|
||||
} XvScreenRec, *XvScreenPtr;
|
||||
|
||||
#define SCREEN_PROLOGUE(pScreen, field)\
|
||||
((pScreen)->field = \
|
||||
((XvScreenPtr) \
|
||||
(pScreen)->devPrivates[XvScreenIndex].ptr)->field)
|
||||
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
||||
|
||||
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
||||
((pScreen)->field = wrapper)
|
||||
|
@ -242,7 +239,7 @@ extern int SProcXvDispatch(ClientPtr);
|
|||
|
||||
extern void XvExtensionInit(void);
|
||||
extern int XvScreenInit(ScreenPtr);
|
||||
extern int XvGetScreenIndex(void);
|
||||
extern DevPrivateKey XvGetScreenKey(void);
|
||||
extern unsigned long XvGetRTPort(void);
|
||||
extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
|
||||
extern int XvdiVideoStopped(XvPortPtr, int);
|
||||
|
|
|
@ -105,7 +105,7 @@ SOFTWARE.
|
|||
#include "xvdisp.h"
|
||||
#endif
|
||||
|
||||
int XvScreenIndex = -1;
|
||||
static DevPrivateKey XvScreenKey = &XvScreenKey;
|
||||
unsigned long XvExtensionGeneration = 0;
|
||||
unsigned long XvScreenGeneration = 0;
|
||||
unsigned long XvResourceGeneration = 0;
|
||||
|
@ -166,12 +166,6 @@ XvExtensionInit(void)
|
|||
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
|
||||
return;
|
||||
}
|
||||
XvScreenIndex = AllocateScreenPrivateIndex ();
|
||||
if (XvScreenIndex < 0)
|
||||
{
|
||||
ErrorF("XvExtensionInit: Unable to allocate screen private index\n");
|
||||
return;
|
||||
}
|
||||
#ifdef PANORAMIX
|
||||
XineramaRegisterConnectionBlockCallback(XineramifyXv);
|
||||
#endif
|
||||
|
@ -265,19 +259,13 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
XvScreenIndex = AllocateScreenPrivateIndex ();
|
||||
if (XvScreenIndex < 0)
|
||||
{
|
||||
ErrorF("XvScreenInit: Unable to allocate screen private index\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
#ifdef PANORAMIX
|
||||
XineramaRegisterConnectionBlockCallback(XineramifyXv);
|
||||
#endif
|
||||
XvScreenGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
if (pScreen->devPrivates[XvScreenIndex].ptr)
|
||||
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey))
|
||||
{
|
||||
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
|
||||
}
|
||||
|
@ -291,7 +279,7 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)pxvs;
|
||||
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
|
||||
|
||||
|
||||
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
|
||||
|
@ -313,7 +301,7 @@ XvCloseScreen(
|
|||
|
||||
XvScreenPtr pxvs;
|
||||
|
||||
pxvs = (XvScreenPtr) pScreen->devPrivates[XvScreenIndex].ptr;
|
||||
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||
|
||||
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
|
||||
pScreen->DestroyWindow = pxvs->DestroyWindow;
|
||||
|
@ -323,7 +311,7 @@ XvCloseScreen(
|
|||
|
||||
xfree(pxvs);
|
||||
|
||||
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
|
||||
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
|
||||
|
||||
return (*pScreen->CloseScreen)(ii, pScreen);
|
||||
|
||||
|
@ -334,10 +322,10 @@ XvResetProc(ExtensionEntry* extEntry)
|
|||
{
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
XvGetScreenIndex(void)
|
||||
_X_EXPORT DevPrivateKey
|
||||
XvGetScreenKey(void)
|
||||
{
|
||||
return XvScreenIndex;
|
||||
return XvScreenKey;
|
||||
}
|
||||
|
||||
_X_EXPORT unsigned long
|
||||
|
@ -361,7 +349,7 @@ XvDestroyPixmap(PixmapPtr pPix)
|
|||
|
||||
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
|
||||
|
||||
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
|
||||
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||
|
||||
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
||||
|
||||
|
@ -413,7 +401,7 @@ XvDestroyWindow(WindowPtr pWin)
|
|||
|
||||
SCREEN_PROLOGUE(pScreen, DestroyWindow);
|
||||
|
||||
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
|
||||
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||
|
||||
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
||||
|
||||
|
|
23
Xext/xvmc.c
23
Xext/xvmc.c
|
@ -39,7 +39,7 @@
|
|||
#define DR_CLIENT_DRIVER_NAME_SIZE 48
|
||||
#define DR_BUSID_SIZE 48
|
||||
|
||||
int XvMCScreenIndex = -1;
|
||||
static DevPrivateKey XvMCScreenKey = NULL;
|
||||
|
||||
unsigned long XvMCGeneration = 0;
|
||||
|
||||
|
@ -63,7 +63,7 @@ typedef struct {
|
|||
} XvMCScreenRec, *XvMCScreenPtr;
|
||||
|
||||
#define XVMC_GET_PRIVATE(pScreen) \
|
||||
(XvMCScreenPtr)((pScreen)->devPrivates[XvMCScreenIndex].ptr)
|
||||
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
|
||||
|
||||
|
||||
static int
|
||||
|
@ -153,7 +153,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
|||
return _XvBadPort;
|
||||
}
|
||||
|
||||
if(XvMCScreenIndex >= 0) { /* any adaptors at all */
|
||||
if(XvMCScreenKey) { /* any adaptors at all */
|
||||
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
||||
if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
|
||||
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
|
||||
|
@ -211,7 +211,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
|
||||
pScreen = pPort->pAdaptor->pScreen;
|
||||
|
||||
if(XvMCScreenIndex < 0) /* no XvMC adaptors */
|
||||
if(XvMCScreenKey == NULL) /* no XvMC adaptors */
|
||||
return BadMatch;
|
||||
|
||||
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
|
||||
|
@ -494,7 +494,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
|
||||
pScreen = pPort->pAdaptor->pScreen;
|
||||
|
||||
if(XvMCScreenIndex < 0) /* No XvMC adaptors */
|
||||
if(XvMCScreenKey == NULL) /* No XvMC adaptors */
|
||||
return BadMatch;
|
||||
|
||||
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
|
||||
|
@ -679,7 +679,7 @@ XvMCExtensionInit(void)
|
|||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
if(XvMCScreenIndex < 0) /* nobody supports it */
|
||||
if(XvMCScreenKey == NULL) /* nobody supports it */
|
||||
return;
|
||||
|
||||
if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes)))
|
||||
|
@ -720,17 +720,12 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
|||
{
|
||||
XvMCScreenPtr pScreenPriv;
|
||||
|
||||
if(XvMCGeneration != serverGeneration) {
|
||||
if((XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return BadAlloc;
|
||||
|
||||
XvMCGeneration = serverGeneration;
|
||||
}
|
||||
XvMCScreenKey = &XvMCScreenKey;
|
||||
|
||||
if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec))))
|
||||
return BadAlloc;
|
||||
|
||||
pScreen->devPrivates[XvMCScreenIndex].ptr = (pointer)pScreenPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
|
||||
|
||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = XvMCCloseScreen;
|
||||
|
@ -754,7 +749,7 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
|||
XvMCAdaptorPtr adaptor = NULL;
|
||||
int i;
|
||||
|
||||
if(XvMCScreenIndex < 0) return NULL;
|
||||
if(XvMCScreenKey == NULL) return NULL;
|
||||
|
||||
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
|
||||
return NULL;
|
||||
|
|
18
afb/afb.h
18
afb/afb.h
|
@ -60,7 +60,6 @@ SOFTWARE.
|
|||
#include "mfb.h"
|
||||
|
||||
extern int afbInverseAlu[];
|
||||
extern int afbScreenPrivateIndex;
|
||||
/* warning: PixelType definition duplicated in maskbits.h */
|
||||
#ifndef PixelType
|
||||
#define PixelType CARD32
|
||||
|
@ -736,14 +735,15 @@ typedef struct {
|
|||
} afbPrivGC;
|
||||
typedef afbPrivGC *afbPrivGCPtr;
|
||||
|
||||
extern int afbGCPrivateIndex; /* index into GC private array */
|
||||
extern int afbWindowPrivateIndex; /* index into Window private array */
|
||||
extern DevPrivateKey afbScreenPrivateKey;
|
||||
extern DevPrivateKey afbGCPrivateKey;
|
||||
extern DevPrivateKey afbWindowPrivateKey;
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
extern int frameWindowPrivateIndex; /* index into Window private array */
|
||||
extern DevPrivateKey frameWindowPrivateKey;
|
||||
#endif
|
||||
|
||||
#define afbGetGCPrivate(pGC) \
|
||||
((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr))
|
||||
((afbPrivGC *)dixLookupPrivate(&(pGC)->devPrivates, afbGCPrivateKey))
|
||||
|
||||
/* private field of window */
|
||||
typedef struct {
|
||||
|
@ -759,7 +759,7 @@ typedef struct {
|
|||
|
||||
#define afbGetTypedWidth(pDrawable,wtype)( \
|
||||
(((pDrawable)->type == DRAWABLE_WINDOW) ? \
|
||||
(int)(((PixmapPtr)((pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr))->devKind) : \
|
||||
(int)(((PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey)->devKind) : \
|
||||
(int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
|
||||
|
||||
#define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char)
|
||||
|
@ -769,7 +769,7 @@ typedef struct {
|
|||
#define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
|
||||
PixmapPtr _pPix; \
|
||||
if ((pDrawable)->type == DRAWABLE_WINDOW) \
|
||||
_pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
|
||||
_pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
|
||||
else \
|
||||
_pPix = (PixmapPtr)(pDrawable); \
|
||||
(pointer) = (ptype *) _pPix->devPrivate.ptr; \
|
||||
|
@ -779,7 +779,7 @@ typedef struct {
|
|||
#define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\
|
||||
PixmapPtr _pPix; \
|
||||
if ((pDrawable)->type == DRAWABLE_WINDOW) \
|
||||
_pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
|
||||
_pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
|
||||
else \
|
||||
_pPix = (PixmapPtr)(pDrawable); \
|
||||
(pointer) = (PixelType *)_pPix->devPrivate.ptr; \
|
||||
|
@ -795,7 +795,7 @@ typedef struct {
|
|||
afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
|
||||
|
||||
#define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
|
||||
PixmapPtr _pPix = (PixmapPtr)(pWin)->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
|
||||
PixmapPtr _pPix = (PixmapPtr)dixLookupPrivate(&(pWin)->drawable.pScreen->devPrivates, afbScreenPrivateKey); \
|
||||
(pointer) = (ptype *) _pPix->devPrivate.ptr; \
|
||||
(width) = ((int) _pPix->devKind) / sizeof (wtype); \
|
||||
}
|
||||
|
|
|
@ -321,7 +321,8 @@ afbPolyFillArcSolid(register DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parc
|
|||
RegionPtr cclip;
|
||||
unsigned char *rrops;
|
||||
|
||||
priv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr;
|
||||
priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
rrops = priv->rrops;
|
||||
cclip = pGC->pCompositeClip;
|
||||
for (arc = parcs, i = narcs; --i >= 0; arc++) {
|
||||
|
|
|
@ -93,7 +93,8 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre
|
|||
unsigned char *rrops;
|
||||
unsigned char *rropsOS;
|
||||
|
||||
priv = (afbPrivGC *)pGC->devPrivates[afbGCPrivateIndex].ptr;
|
||||
priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
prgnClip = pGC->pCompositeClip;
|
||||
rrops = priv->rrops;
|
||||
rropsOS = priv->rropOS;
|
||||
|
|
|
@ -123,7 +123,8 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
|
|||
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
|
||||
pBase);
|
||||
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
while (n--) {
|
||||
addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
|
||||
|
||||
|
@ -238,8 +239,8 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
|
|||
tileHeight = pStipple->drawable.height;
|
||||
psrc = (PixelType *)(pStipple->devPrivate.ptr);
|
||||
|
||||
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
|
||||
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
while (n--) {
|
||||
src = psrc[ppt->y % tileHeight];
|
||||
addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
|
||||
|
@ -484,8 +485,8 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
|
|||
tileHeight = pTile->drawable.height;
|
||||
psrc = (PixelType *)(pTile->devPrivate.ptr);
|
||||
rop = pGC->alu;
|
||||
rropsOS = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rropOS;
|
||||
|
||||
rropsOS = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rropOS;
|
||||
switch(rop) {
|
||||
case GXcopy:
|
||||
while (n--) {
|
||||
|
@ -793,8 +794,8 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
|
|||
|
||||
tileWidth = pTile->drawable.width;
|
||||
tileHeight = pTile->drawable.height;
|
||||
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
|
||||
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
/* this replaces rotating the stipple. Instead, we just adjust the offset
|
||||
* at which we start grabbing bits from the stipple.
|
||||
* Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
|
||||
|
|
|
@ -154,7 +154,8 @@ afbCreateGC(pGC)
|
|||
/* afb wants to translate before scan convesion */
|
||||
pGC->miTranslate = 1;
|
||||
|
||||
pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
|
||||
pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
|
||||
pPriv->rrops);
|
||||
afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
|
||||
|
@ -295,8 +296,8 @@ afbValidateGC(pGC, changes, pDrawable)
|
|||
(oldOrg.y != pGC->lastWinOrg.y);
|
||||
|
||||
|
||||
devPriv = ((afbPrivGCPtr)(pGC->devPrivates[afbGCPrivateIndex].ptr));
|
||||
|
||||
devPriv = (afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
|
||||
/*
|
||||
if the client clip is different or moved OR
|
||||
|
|
|
@ -145,8 +145,8 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
|||
register int nFirst;/* bits of glyph in current longword */
|
||||
PixelType *pdstSave;
|
||||
int oldFill;
|
||||
afbPrivGC *pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
|
||||
|
||||
afbPrivGC *pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
xorg = pDrawable->x;
|
||||
yorg = pDrawable->y;
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst,
|
||||
|
|
|
@ -147,7 +147,8 @@ afbLineSS(pDrawable, pGC, mode, npt, pptInit)
|
|||
RegionPtr cclip;
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
|
@ -487,7 +488,8 @@ afbLineSD(pDrawable, pGC, mode, npt, pptInit)
|
|||
#endif
|
||||
|
||||
cclip = pGC->pCompositeClip;
|
||||
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
pboxInit = REGION_RECTS(cclip);
|
||||
nboxInit = REGION_NUM_RECTS(cclip);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ afbDestroyPixmap(pPixmap)
|
|||
{
|
||||
if(--pPixmap->refcnt)
|
||||
return(TRUE);
|
||||
dixFreePrivates(*DEVPRIV_PTR(pPixmap));
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
return(TRUE);
|
||||
}
|
||||
|
|
|
@ -100,8 +100,8 @@ afbFillPolygonSolid (pDrawable, pGC, shape, mode, count, ptsIn)
|
|||
int depthDst;
|
||||
register PixelType *pdst;
|
||||
|
||||
devPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
|
||||
|
||||
devPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
if (mode == CoordModePrevious || shape != Convex ||
|
||||
REGION_NUM_RECTS(pGC->pCompositeClip) != 1) {
|
||||
miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn);
|
||||
|
|
|
@ -146,8 +146,8 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
|||
bbox.y1 = y - info.overallAscent;
|
||||
bbox.y2 = y + info.overallDescent;
|
||||
|
||||
rrops = ((afbPrivGCPtr) pGC->devPrivates[afbGCPrivateIndex].ptr)->rrops;
|
||||
|
||||
rrops = ((afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) {
|
||||
case rgnOUT:
|
||||
break;
|
||||
|
|
|
@ -57,6 +57,7 @@ SOFTWARE.
|
|||
#include "regionstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "privates.h"
|
||||
|
||||
#include "afb.h"
|
||||
#include "maskbits.h"
|
||||
|
@ -71,7 +72,8 @@ afbPaintWindow(pWin, pRegion, what)
|
|||
register afbPrivWin *pPrivWin;
|
||||
unsigned char rrops[AFB_MAX_DEPTH];
|
||||
|
||||
pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
|
||||
pPrivWin = (afbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
|
||||
afbWindowPrivateKey);
|
||||
|
||||
switch (what) {
|
||||
case PW_BACKGROUND:
|
||||
|
|
|
@ -90,8 +90,8 @@ afbPolyPoint(pDrawable, pGC, mode, npt, pptInit)
|
|||
register unsigned char *rrops;
|
||||
afbPrivGC *pGCPriv;
|
||||
|
||||
pGCPriv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr;
|
||||
|
||||
pGCPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey);
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
|
||||
pBaseSave);
|
||||
|
||||
|
|
|
@ -69,13 +69,11 @@ SOFTWARE.
|
|||
#include "servermd.h"
|
||||
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
int frameWindowPrivateIndex;
|
||||
DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey;
|
||||
#endif
|
||||
int afbWindowPrivateIndex;
|
||||
int afbGCPrivateIndex;
|
||||
int afbScreenPrivateIndex;
|
||||
|
||||
static unsigned long afbGeneration = 0;
|
||||
DevPrivateKey afbWindowPrivateKey = &afbWindowPrivateKey;
|
||||
DevPrivateKey afbGCPrivateKey = &afbGCPrivateKey;
|
||||
DevPrivateKey afbScreenPrivateKey = &afbScreenPrivateKey;
|
||||
|
||||
static Bool
|
||||
afbCloseScreen(int index, ScreenPtr pScreen)
|
||||
|
@ -87,7 +85,7 @@ afbCloseScreen(int index, ScreenPtr pScreen)
|
|||
xfree(depths[d].vids);
|
||||
xfree(depths);
|
||||
xfree(pScreen->visuals);
|
||||
xfree(pScreen->devPrivates[afbScreenPrivateIndex].ptr);
|
||||
xfree(dixLookupPrivate(&pScreen->devPrivates, afbScreenPrivateKey));
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
@ -98,7 +96,8 @@ afbCreateScreenResources(ScreenPtr pScreen)
|
|||
|
||||
pointer oldDevPrivate = pScreen->devPrivate;
|
||||
|
||||
pScreen->devPrivate = pScreen->devPrivates[afbScreenPrivateIndex].ptr;
|
||||
pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates,
|
||||
afbScreenPrivateKey);
|
||||
retval = miCreateScreenResources(pScreen);
|
||||
|
||||
/* Modify screen's pixmap devKind value stored off devPrivate to
|
||||
|
@ -106,7 +105,8 @@ afbCreateScreenResources(ScreenPtr pScreen)
|
|||
* of a chunky screen in longs as incorrectly setup by the mi routine.
|
||||
*/
|
||||
((PixmapPtr)pScreen->devPrivate)->devKind = BitmapBytePad(pScreen->width);
|
||||
pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate;
|
||||
dixSetPrivate(&pScreen->devPrivates, afbScreenPrivateKey,
|
||||
pScreen->devPrivate);
|
||||
pScreen->devPrivate = oldDevPrivate;
|
||||
return(retval);
|
||||
}
|
||||
|
@ -115,7 +115,8 @@ static PixmapPtr
|
|||
afbGetWindowPixmap(WindowPtr pWin)
|
||||
{
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
|
||||
return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates,
|
||||
frameWindowPrivateKey);
|
||||
#else
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
|
@ -127,33 +128,25 @@ static void
|
|||
afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
|
||||
{
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
|
||||
dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix);
|
||||
#else
|
||||
(* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
|
||||
#endif
|
||||
}
|
||||
|
||||
static Bool
|
||||
afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex)
|
||||
afbAllocatePrivates(ScreenPtr pScreen,
|
||||
DevPrivateKey *pWinKey, DevPrivateKey *pGCKey)
|
||||
{
|
||||
if (afbGeneration != serverGeneration) {
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
frameWindowPrivateIndex = AllocateWindowPrivateIndex();
|
||||
#endif
|
||||
afbWindowPrivateIndex = AllocateWindowPrivateIndex();
|
||||
afbGCPrivateIndex = AllocateGCPrivateIndex();
|
||||
afbGeneration = serverGeneration;
|
||||
}
|
||||
if (pWinIndex)
|
||||
*pWinIndex = afbWindowPrivateIndex;
|
||||
if (pGCIndex)
|
||||
*pGCIndex = afbGCPrivateIndex;
|
||||
if (pWinKey)
|
||||
*pWinKey = afbWindowPrivateKey;
|
||||
if (pGCKey)
|
||||
*pGCKey = afbGCPrivateKey;
|
||||
|
||||
afbScreenPrivateIndex = AllocateScreenPrivateIndex();
|
||||
pScreen->GetWindowPixmap = afbGetWindowPixmap;
|
||||
pScreen->SetWindowPixmap = afbSetWindowPixmap;
|
||||
return(AllocateWindowPrivate(pScreen, afbWindowPrivateIndex, sizeof(afbPrivWin)) &&
|
||||
AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC)));
|
||||
return(dixRequestPrivate(afbWindowPrivateKey, sizeof(afbPrivWin)) &&
|
||||
dixRequestPrivate(afbGCPrivateKey, sizeof(afbPrivGC)));
|
||||
}
|
||||
|
||||
/* dts * (inch/dot) * (25.4 mm / inch) = mm */
|
||||
|
@ -179,7 +172,7 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i
|
|||
ErrorF("afbInitVisuals: FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
if (!afbAllocatePrivates(pScreen,(int *)NULL, (int *)NULL)) {
|
||||
if (!afbAllocatePrivates(pScreen, NULL, NULL)) {
|
||||
ErrorF("afbAllocatePrivates: FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -224,7 +217,8 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i
|
|||
pScreen->CloseScreen = afbCloseScreen;
|
||||
pScreen->CreateScreenResources = afbCreateScreenResources;
|
||||
|
||||
pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate;
|
||||
dixSetPrivate(&pScreen->devPrivates, afbScreenPrivateKey,
|
||||
pScreen->devPrivate);
|
||||
pScreen->devPrivate = oldDevPrivate;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -261,8 +261,8 @@ afbTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
|
|||
xpos += FONTMAXBOUNDS(pfont,leftSideBearing);
|
||||
ypos -= FONTASCENT(pfont);
|
||||
|
||||
rrops = ((afbPrivGCPtr) pGC->devPrivates[afbGCPrivateIndex].ptr)->rropOS;
|
||||
|
||||
rrops = ((afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rropOS;
|
||||
bbox.x1 = xpos;
|
||||
bbox.x2 = xpos + (widthGlyph * nglyph);
|
||||
bbox.y1 = ypos;
|
||||
|
|
|
@ -56,6 +56,7 @@ SOFTWARE.
|
|||
#include <X11/X.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "privates.h"
|
||||
#include "afb.h"
|
||||
#include "mistruct.h"
|
||||
#include "regionstr.h"
|
||||
|
@ -67,14 +68,16 @@ afbCreateWindow(pWin)
|
|||
{
|
||||
register afbPrivWin *pPrivWin;
|
||||
|
||||
pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
|
||||
pPrivWin = (afbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
|
||||
afbWindowPrivateKey);
|
||||
pPrivWin->pRotatedBorder = NullPixmap;
|
||||
pPrivWin->pRotatedBackground = NullPixmap;
|
||||
pPrivWin->fastBackground = FALSE;
|
||||
pPrivWin->fastBorder = FALSE;
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
pWin->devPrivates[frameWindowPrivateIndex].ptr =
|
||||
pWin->pDrawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr;
|
||||
dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey,
|
||||
dixLookupPrivate(&pWin->pDrawable.pScreen->devPrivates,
|
||||
afbScreenPrivateKey));
|
||||
#endif
|
||||
|
||||
return (TRUE);
|
||||
|
@ -88,8 +91,8 @@ afbDestroyWindow(pWin)
|
|||
{
|
||||
register afbPrivWin *pPrivWin;
|
||||
|
||||
pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
|
||||
|
||||
pPrivWin = (afbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
|
||||
afbWindowPrivateKey);
|
||||
if (pPrivWin->pRotatedBorder)
|
||||
(*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder);
|
||||
if (pPrivWin->pRotatedBackground)
|
||||
|
@ -123,7 +126,8 @@ afbPositionWindow(pWin, x, y)
|
|||
register afbPrivWin *pPrivWin;
|
||||
int reset = 0;
|
||||
|
||||
pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
|
||||
pPrivWin = (afbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
|
||||
afbWindowPrivateKey);
|
||||
if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) {
|
||||
afbXRotatePixmap(pPrivWin->pRotatedBackground,
|
||||
pWin->drawable.x - pPrivWin->oldRotate.x);
|
||||
|
@ -230,7 +234,8 @@ afbChangeWindowAttributes(pWin, mask)
|
|||
register afbPrivWin *pPrivWin;
|
||||
WindowPtr pBgWin;
|
||||
|
||||
pPrivWin = (afbPrivWin *)(pWin->devPrivates[afbWindowPrivateIndex].ptr);
|
||||
pPrivWin = (afbPrivWin *)dixLookupPrivate(&pWin->devPrivates,
|
||||
afbWindowPrivateKey);
|
||||
/*
|
||||
* When background state changes from ParentRelative and
|
||||
* we had previously rotated the fast border pixmap to match
|
||||
|
|
|
@ -96,8 +96,8 @@ afbZeroArcSS(DrawablePtr pDraw, GCPtr pGC, xArc *arc)
|
|||
register PixelType *paddr;
|
||||
register unsigned char *rrops;
|
||||
|
||||
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
|
||||
|
||||
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
|
||||
afbGCPrivateKey))->rrops;
|
||||
afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst,
|
||||
addrl);
|
||||
do360 = miZeroArcSetup(arc, &info, TRUE);
|
||||
|
|
14
cfb/cfb.h
14
cfb/cfb.h
|
@ -56,8 +56,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
pixmap.devKind = width_of_pixmap_in_bytes
|
||||
*/
|
||||
|
||||
extern int cfbGCPrivateIndex;
|
||||
extern int cfbWindowPrivateIndex;
|
||||
extern DevPrivateKey cfbGCPrivateKey;
|
||||
extern DevPrivateKey cfbWindowPrivateKey;
|
||||
|
||||
/* private field of GC */
|
||||
typedef struct {
|
||||
|
@ -72,7 +72,7 @@ typedef struct {
|
|||
typedef cfbPrivGC *cfbPrivGCPtr;
|
||||
|
||||
#define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\
|
||||
(pGC)->devPrivates[cfbGCPrivateIndex].ptr)
|
||||
dixLookupPrivate(&(pGC)->devPrivates, cfbGCPrivateKey))
|
||||
|
||||
#define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
|
||||
|
||||
|
@ -93,7 +93,7 @@ typedef struct {
|
|||
} cfbPrivWin;
|
||||
|
||||
#define cfbGetWindowPrivate(_pWin) ((cfbPrivWin *)\
|
||||
(_pWin)->devPrivates[cfbWindowPrivateIndex].ptr)
|
||||
dixLookupPrivate(&(_pWin)->devPrivates, cfbWindowPrivateKey))
|
||||
|
||||
|
||||
/* cfb8bit.c */
|
||||
|
@ -314,8 +314,8 @@ extern int cfb8SegmentSS1RectXor(
|
|||
|
||||
extern Bool cfbAllocatePrivates(
|
||||
ScreenPtr /*pScreen*/,
|
||||
int * /*window_index*/,
|
||||
int * /*gc_index*/
|
||||
DevPrivateKey * /*window_key*/,
|
||||
DevPrivateKey * /*gc_key*/
|
||||
);
|
||||
/* cfbbitblt.c */
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ extern void cfbZeroPolyArcSS8Xor(
|
|||
|
||||
#define CFB_NEED_SCREEN_PRIVATE
|
||||
|
||||
extern int cfbScreenPrivateIndex;
|
||||
extern DevPrivateKey cfbScreenPrivateKey;
|
||||
#endif
|
||||
|
||||
#ifndef CFB_PROTOTYPES_ONLY
|
||||
|
|
|
@ -45,48 +45,37 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "mibstore.h"
|
||||
|
||||
#if 1 || PSZ==8
|
||||
int cfbWindowPrivateIndex = -1;
|
||||
int cfbGCPrivateIndex = -1;
|
||||
DevPrivateKey cfbWindowPrivateKey = &cfbWindowPrivateKey;
|
||||
DevPrivateKey cfbGCPrivateKey = &cfbGCPrivateKey;
|
||||
#endif
|
||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
||||
int cfbScreenPrivateIndex = -1;
|
||||
static unsigned long cfbGeneration = 0;
|
||||
DevPrivateKey cfbScreenPrivateKey = &cfbScreenPrivateKey;
|
||||
#endif
|
||||
|
||||
|
||||
Bool
|
||||
cfbAllocatePrivates(pScreen, window_index, gc_index)
|
||||
cfbAllocatePrivates(pScreen, window_key, gc_key)
|
||||
ScreenPtr pScreen;
|
||||
int *window_index, *gc_index;
|
||||
DevPrivateKey *window_key, *gc_key;
|
||||
{
|
||||
if (!window_index || !gc_index ||
|
||||
(*window_index == -1 && *gc_index == -1))
|
||||
if (!window_key || !gc_key || (!*window_key && !*gc_key))
|
||||
{
|
||||
if (!mfbAllocatePrivates(pScreen,
|
||||
&cfbWindowPrivateIndex, &cfbGCPrivateIndex))
|
||||
&cfbWindowPrivateKey, &cfbGCPrivateKey))
|
||||
return FALSE;
|
||||
if (window_index)
|
||||
*window_index = cfbWindowPrivateIndex;
|
||||
if (gc_index)
|
||||
*gc_index = cfbGCPrivateIndex;
|
||||
if (window_key)
|
||||
*window_key = cfbWindowPrivateKey;
|
||||
if (gc_key)
|
||||
*gc_key = cfbGCPrivateKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
cfbWindowPrivateIndex = *window_index;
|
||||
cfbGCPrivateIndex = *gc_index;
|
||||
cfbWindowPrivateKey = *window_key;
|
||||
cfbGCPrivateKey = *gc_key;
|
||||
}
|
||||
if (!AllocateWindowPrivate(pScreen, cfbWindowPrivateIndex,
|
||||
sizeof(cfbPrivWin)) ||
|
||||
!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC)))
|
||||
if (!dixRequestPrivate(cfbWindowPrivateKey, sizeof(cfbPrivWin)))
|
||||
return FALSE;
|
||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
||||
if (cfbGeneration != serverGeneration)
|
||||
{
|
||||
cfbScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
cfbGeneration = serverGeneration;
|
||||
}
|
||||
if (cfbScreenPrivateIndex == -1)
|
||||
if (!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)))
|
||||
return FALSE;
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ cfbDestroyPixmap(pPixmap)
|
|||
{
|
||||
if(--pPixmap->refcnt)
|
||||
return TRUE;
|
||||
dixFreePrivates(*DEVPRIV_PTR(pPixmap));
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ in this Software without prior written authorization from The Open Group.
|
|||
#endif
|
||||
|
||||
#define RROP_FETCH_GC(gc) \
|
||||
RROP_FETCH_GCPRIV(((cfbPrivGCPtr)(gc)->devPrivates[cfbGCPrivateIndex].ptr))
|
||||
RROP_FETCH_GCPRIV((cfbPrivGCPtr)dixLookupPrivate(&(gc)->devPrivates, \
|
||||
cfbGCPrivateKey))
|
||||
|
||||
#ifndef RROP
|
||||
#define RROP GXset
|
||||
|
|
|
@ -59,7 +59,7 @@ cfbCloseScreen (index, pScreen)
|
|||
xfree (depths);
|
||||
xfree (pScreen->visuals);
|
||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
||||
xfree (pScreen->devPrivates[cfbScreenPrivateIndex].ptr);
|
||||
xfree (dixLookupPrivate(&pScreen->devPrivates, cfbScreenPrivateKey));
|
||||
#else
|
||||
xfree (pScreen->devPrivate);
|
||||
#endif
|
||||
|
@ -88,7 +88,7 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
|
|||
int dpix, dpiy; /* dots per inch */
|
||||
int width; /* pixel width of frame buffer */
|
||||
{
|
||||
if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0))
|
||||
if (!cfbAllocatePrivates(pScreen, NULL, NULL))
|
||||
return FALSE;
|
||||
pScreen->defColormap = FakeClientID(0);
|
||||
/* let CreateDefColormap do whatever it wants for pixels */
|
||||
|
@ -132,9 +132,11 @@ cfbCreateScreenResources(pScreen)
|
|||
Bool retval;
|
||||
|
||||
pointer oldDevPrivate = pScreen->devPrivate;
|
||||
pScreen->devPrivate = pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
|
||||
pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates,
|
||||
cfbScreenPrivateKey);
|
||||
retval = miCreateScreenResources(pScreen);
|
||||
pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate;
|
||||
dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey,
|
||||
pScreen->devPrivate);
|
||||
pScreen->devPrivate = oldDevPrivate;
|
||||
return retval;
|
||||
}
|
||||
|
@ -173,7 +175,8 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
|
|||
pScreen->CloseScreen = cfbCloseScreen;
|
||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
||||
pScreen->CreateScreenResources = cfbCreateScreenResources;
|
||||
pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate;
|
||||
dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey,
|
||||
pScreen->devPrivate);
|
||||
pScreen->devPrivate = oldDevPrivate;
|
||||
#endif
|
||||
pScreen->GetScreenPixmap = cfbGetScreenPixmap;
|
||||
|
@ -200,7 +203,8 @@ cfbGetScreenPixmap(pScreen)
|
|||
ScreenPtr pScreen;
|
||||
{
|
||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
||||
return (PixmapPtr)pScreen->devPrivates[cfbScreenPrivateIndex].ptr;
|
||||
return (PixmapPtr)dixLookupPrivate(&pScreen->devPrivates,
|
||||
cfbScreenPrivateKey);
|
||||
#else
|
||||
return (PixmapPtr)pScreen->devPrivate;
|
||||
#endif
|
||||
|
@ -212,8 +216,8 @@ cfbSetScreenPixmap(pPix)
|
|||
{
|
||||
#ifdef CFB_NEED_SCREEN_PRIVATE
|
||||
if (pPix)
|
||||
pPix->drawable.pScreen->devPrivates[cfbScreenPrivateIndex].ptr =
|
||||
(pointer)pPix;
|
||||
dixSetPrivate(&pPix->drawable.pScreen->devPrivates,
|
||||
cfbScreenPrivateKey, pPix);
|
||||
#else
|
||||
if (pPix)
|
||||
pPix->drawable.pScreen->devPrivate = (pointer)pPix;
|
||||
|
|
|
@ -75,8 +75,8 @@ cfbCreateWindow(pWin)
|
|||
|
||||
#ifdef PIXMAP_PER_WINDOW
|
||||
/* Setup pointer to Screen pixmap */
|
||||
pWin->devPrivates[frameWindowPrivateIndex].ptr =
|
||||
(pointer) cfbGetScreenPixmap(pWin->drawable.pScreen);
|
||||
dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey,
|
||||
cfbGetScreenPixmap(pWin->drawable.pScreen));
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
@ -213,7 +213,7 @@ cfbCopyWindow(pWin, ptOldOrg, prgnSrc)
|
|||
|
||||
/* swap in correct PaintWindow* routine. If we can use a fast output
|
||||
routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy
|
||||
of it in devPrivates[cfbWindowPrivateIndex].ptr.
|
||||
of it in devPrivates under cfbWindowPrivateKey.
|
||||
*/
|
||||
Bool
|
||||
cfbChangeWindowAttributes(pWin, mask)
|
||||
|
|
|
@ -137,7 +137,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
cw->oldy = COMP_ORIGIN_INVALID;
|
||||
cw->damageRegistered = FALSE;
|
||||
cw->damaged = FALSE;
|
||||
pWin->devPrivates[CompWindowPrivateIndex].ptr = cw;
|
||||
dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);
|
||||
}
|
||||
ccw->next = cw->clients;
|
||||
cw->clients = ccw;
|
||||
|
@ -212,7 +212,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
|||
|
||||
REGION_UNINIT (pScreen, &cw->borderClip);
|
||||
|
||||
pWin->devPrivates[CompWindowPrivateIndex].ptr = 0;
|
||||
dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
|
||||
xfree (cw);
|
||||
}
|
||||
else if (cw->update == CompositeRedirectAutomatic &&
|
||||
|
@ -297,7 +297,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
}
|
||||
csw->update = CompositeRedirectAutomatic;
|
||||
csw->clients = 0;
|
||||
pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = csw;
|
||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);
|
||||
}
|
||||
/*
|
||||
* Redirect all existing windows
|
||||
|
@ -312,7 +312,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
if (!csw->clients)
|
||||
{
|
||||
xfree (csw);
|
||||
pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0;
|
||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
|
||||
}
|
||||
xfree (ccw);
|
||||
return ret;
|
||||
|
@ -385,7 +385,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
|
|||
*/
|
||||
if (!csw->clients)
|
||||
{
|
||||
pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0;
|
||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
|
||||
xfree (csw);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#define SERVER_COMPOSITE_MINOR 4
|
||||
|
||||
static CARD8 CompositeReqCode;
|
||||
static int CompositeClientPrivateIndex;
|
||||
static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey;
|
||||
RESTYPE CompositeClientWindowType;
|
||||
RESTYPE CompositeClientSubwindowsType;
|
||||
static RESTYPE CompositeClientOverlayType;
|
||||
|
@ -63,7 +63,8 @@ typedef struct _CompositeClient {
|
|||
int minor_version;
|
||||
} CompositeClientRec, *CompositeClientPtr;
|
||||
|
||||
#define GetCompositeClient(pClient) ((CompositeClientPtr) (pClient)->devPrivates[CompositeClientPrivateIndex].ptr)
|
||||
#define GetCompositeClient(pClient) ((CompositeClientPtr) \
|
||||
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
|
||||
|
||||
static void
|
||||
CompositeClientCallback (CallbackListPtr *list,
|
||||
|
@ -712,9 +713,8 @@ CompositeExtensionInit (void)
|
|||
if (!CompositeClientOverlayType)
|
||||
return;
|
||||
|
||||
CompositeClientPrivateIndex = AllocateClientPrivateIndex ();
|
||||
if (!AllocateClientPrivate (CompositeClientPrivateIndex,
|
||||
sizeof (CompositeClientRec)))
|
||||
if (!dixRequestPrivate(CompositeClientPrivateKey,
|
||||
sizeof(CompositeClientRec)))
|
||||
return;
|
||||
if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0))
|
||||
return;
|
||||
|
|
|
@ -46,10 +46,9 @@
|
|||
|
||||
#include "compint.h"
|
||||
|
||||
int CompScreenPrivateIndex;
|
||||
int CompWindowPrivateIndex;
|
||||
int CompSubwindowsPrivateIndex;
|
||||
static int CompGeneration;
|
||||
DevPrivateKey CompScreenPrivateKey = &CompScreenPrivateKey;
|
||||
DevPrivateKey CompWindowPrivateKey = &CompWindowPrivateKey;
|
||||
DevPrivateKey CompSubwindowsPrivateKey = &CompSubwindowsPrivateKey;
|
||||
|
||||
|
||||
static Bool
|
||||
|
@ -87,7 +86,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
|
|||
cs->pOverlayWin = NULL;
|
||||
|
||||
xfree (cs);
|
||||
pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0;
|
||||
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
|
||||
ret = (*pScreen->CloseScreen) (index, pScreen);
|
||||
|
||||
return ret;
|
||||
|
@ -375,25 +374,6 @@ compScreenInit (ScreenPtr pScreen)
|
|||
{
|
||||
CompScreenPtr cs;
|
||||
|
||||
if (CompGeneration != serverGeneration)
|
||||
{
|
||||
CompScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
if (CompScreenPrivateIndex == -1)
|
||||
return FALSE;
|
||||
CompWindowPrivateIndex = AllocateWindowPrivateIndex ();
|
||||
if (CompWindowPrivateIndex == -1)
|
||||
return FALSE;
|
||||
CompSubwindowsPrivateIndex = AllocateWindowPrivateIndex ();
|
||||
if (CompSubwindowsPrivateIndex == -1)
|
||||
return FALSE;
|
||||
CompGeneration = serverGeneration;
|
||||
}
|
||||
if (!AllocateWindowPrivate (pScreen, CompWindowPrivateIndex, 0))
|
||||
return FALSE;
|
||||
|
||||
if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivateIndex, 0))
|
||||
return FALSE;
|
||||
|
||||
if (GetCompScreen (pScreen))
|
||||
return TRUE;
|
||||
cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
|
||||
|
@ -461,7 +441,7 @@ compScreenInit (ScreenPtr pScreen)
|
|||
cs->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = compCloseScreen;
|
||||
|
||||
pScreen->devPrivates[CompScreenPrivateIndex].ptr = (pointer) cs;
|
||||
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
|
||||
|
||||
RegisterRealChildHeadProc(CompositeRealChildHead);
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "globals.h"
|
||||
#include "picturestr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "privates.h"
|
||||
#include "mi.h"
|
||||
#include "damage.h"
|
||||
#include "damageextint.h"
|
||||
|
@ -159,13 +160,16 @@ typedef struct _CompScreen {
|
|||
|
||||
} CompScreenRec, *CompScreenPtr;
|
||||
|
||||
extern int CompScreenPrivateIndex;
|
||||
extern int CompWindowPrivateIndex;
|
||||
extern int CompSubwindowsPrivateIndex;
|
||||
extern DevPrivateKey CompScreenPrivateKey;
|
||||
extern DevPrivateKey CompWindowPrivateKey;
|
||||
extern DevPrivateKey CompSubwindowsPrivateKey;
|
||||
|
||||
#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr))
|
||||
#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr))
|
||||
#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr))
|
||||
#define GetCompScreen(s) ((CompScreenPtr) \
|
||||
dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey))
|
||||
#define GetCompWindow(w) ((CompWindowPtr) \
|
||||
dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey))
|
||||
#define GetCompSubwindows(w) ((CompSubwindowsPtr) \
|
||||
dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey))
|
||||
|
||||
extern RESTYPE CompositeClientWindowType;
|
||||
extern RESTYPE CompositeClientSubwindowsType;
|
||||
|
|
|
@ -1027,7 +1027,6 @@ AC_DEFINE(XTEST, 1, [Support XTest extension])
|
|||
AC_DEFINE(XSYNC, 1, [Support XSync extension])
|
||||
AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
|
||||
AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
|
||||
AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])
|
||||
|
||||
if test "x$WDTRACE" != "xno" ; then
|
||||
DIX_LIB='$(top_builddir)/dix/dix.O'
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
static unsigned char DamageReqCode;
|
||||
static int DamageEventBase;
|
||||
static int DamageErrorBase;
|
||||
static int DamageClientPrivateIndex;
|
||||
static DevPrivateKey DamageClientPrivateKey = &DamageClientPrivateKey;
|
||||
static RESTYPE DamageExtType;
|
||||
static RESTYPE DamageExtWinType;
|
||||
|
||||
|
@ -511,9 +511,7 @@ DamageExtensionInit(void)
|
|||
if (!DamageExtWinType)
|
||||
return;
|
||||
|
||||
DamageClientPrivateIndex = AllocateClientPrivateIndex ();
|
||||
if (!AllocateClientPrivate (DamageClientPrivateIndex,
|
||||
sizeof (DamageClientRec)))
|
||||
if (!dixRequestPrivate(DamageClientPrivateKey, sizeof (DamageClientRec)))
|
||||
return;
|
||||
if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0))
|
||||
return;
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct _DamageClient {
|
|||
int critical;
|
||||
} DamageClientRec, *DamageClientPtr;
|
||||
|
||||
#define GetDamageClient(pClient) ((DamageClientPtr) (pClient)->devPrivates[DamageClientPrivateIndex].ptr)
|
||||
#define GetDamageClient(pClient) ((DamageClientPtr)dixLookupPrivate(&(pClient)->devPrivates, DamageClientPrivateKey))
|
||||
|
||||
typedef struct _DamageExt {
|
||||
DamagePtr pDamage;
|
||||
|
|
226
dbe/dbe.c
226
dbe/dbe.c
|
@ -58,19 +58,16 @@
|
|||
/* GLOBALS */
|
||||
|
||||
/* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */
|
||||
static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
|
||||
static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */
|
||||
|
||||
/* These are static globals copied to DBE's screen private for use by DDX */
|
||||
static int dbeScreenPrivIndex;
|
||||
static int dbeWindowPrivIndex;
|
||||
static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKey;
|
||||
static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKey;
|
||||
|
||||
/* These are static globals copied to DBE's screen private for use by DDX */
|
||||
static RESTYPE dbeDrawableResType;
|
||||
static RESTYPE dbeWindowPrivResType;
|
||||
|
||||
/* This global is used by DbeAllocWinPrivPrivIndex() */
|
||||
static int winPrivPrivCount = 0;
|
||||
|
||||
/* Used to generate DBE's BadBuffer error. */
|
||||
static int dbeErrorBase;
|
||||
|
||||
|
@ -112,146 +109,6 @@ DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */))
|
|||
|
||||
} /* DbeRegisterFunction() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* DBE DIX Procedure: DbeAllocWinPriv
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This function was cloned from AllocateWindow() in window.c.
|
||||
* This function allocates a window priv structure to be associated
|
||||
* with a double-buffered window.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static DbeWindowPrivPtr
|
||||
DbeAllocWinPriv(ScreenPtr pScreen)
|
||||
{
|
||||
DbeWindowPrivPtr pDbeWindowPriv;
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
register char *ptr;
|
||||
register DevUnion *ppriv;
|
||||
register unsigned int *sizes;
|
||||
register unsigned int size;
|
||||
register int i;
|
||||
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||
pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(pDbeScreenPriv->totalWinPrivSize);
|
||||
|
||||
if (pDbeWindowPriv)
|
||||
{
|
||||
ppriv = (DevUnion *)(pDbeWindowPriv + 1);
|
||||
pDbeWindowPriv->devPrivates = ppriv;
|
||||
sizes = pDbeScreenPriv->winPrivPrivSizes;
|
||||
ptr = (char *)(ppriv + pDbeScreenPriv->winPrivPrivLen);
|
||||
for (i = pDbeScreenPriv->winPrivPrivLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ((size = *sizes))
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return(pDbeWindowPriv);
|
||||
|
||||
} /* DbeAllocWinPriv() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* DBE DIX Procedure: DbeFallbackAllocWinPriv
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This is a fallback function for AllocWinPriv().
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#if 0 /* NOT USED */
|
||||
static DbeWindowPrivPtr
|
||||
DbeFallbackAllocWinPriv(pScreen)
|
||||
ScreenPtr pScreen;
|
||||
{
|
||||
return (NULL);
|
||||
} /* DbeFallbackAllocWinPriv() */
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* DBE DIX Procedure: DbeAllocWinPrivPrivIndex
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This function was cloned from AllocateWindowPrivateIndex() in window.c.
|
||||
* This function allocates a new window priv priv index by simply returning
|
||||
* an incremented private counter.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static int
|
||||
DbeAllocWinPrivPrivIndex(void)
|
||||
{
|
||||
return winPrivPrivCount++;
|
||||
|
||||
} /* DbeAllocWinPrivPrivIndex() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* DBE DIX Procedure: DbeAllocWinPrivPriv
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This function was cloned from AllocateWindowPrivate() in privates.c.
|
||||
* This function allocates a private structure to be hung off
|
||||
* a window private.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static Bool
|
||||
DbeAllocWinPrivPriv(register ScreenPtr pScreen, int index, unsigned int amount)
|
||||
{
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
unsigned int oldamount;
|
||||
|
||||
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (index >= pDbeScreenPriv->winPrivPrivLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(pDbeScreenPriv->winPrivPrivSizes,
|
||||
(index + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
while (pDbeScreenPriv->winPrivPrivLen <= index)
|
||||
{
|
||||
nsizes[pDbeScreenPriv->winPrivPrivLen++] = 0;
|
||||
pDbeScreenPriv->totalWinPrivSize += sizeof(DevUnion);
|
||||
}
|
||||
|
||||
pDbeScreenPriv->winPrivPrivSizes = nsizes;
|
||||
}
|
||||
|
||||
oldamount = pDbeScreenPriv->winPrivPrivSizes[index];
|
||||
|
||||
if (amount > oldamount)
|
||||
{
|
||||
pDbeScreenPriv->winPrivPrivSizes[index] = amount;
|
||||
pDbeScreenPriv->totalWinPrivSize += (amount - oldamount);
|
||||
}
|
||||
return(TRUE);
|
||||
|
||||
} /* DbeAllocWinPrivPriv() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
@ -269,9 +126,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
|
|||
{
|
||||
/* Stub DIX. */
|
||||
pDbeScreenPriv->SetupBackgroundPainter = NULL;
|
||||
pDbeScreenPriv->AllocWinPriv = NULL;
|
||||
pDbeScreenPriv->AllocWinPrivPrivIndex = NULL;
|
||||
pDbeScreenPriv->AllocWinPrivPriv = NULL;
|
||||
|
||||
/* Do not unwrap PositionWindow nor DestroyWindow. If the DDX
|
||||
* initialization function failed, we assume that it did not wrap
|
||||
|
@ -439,11 +293,10 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
* Allocate a window priv.
|
||||
*/
|
||||
|
||||
if (!(pDbeWindowPriv =
|
||||
(*pDbeScreenPriv->AllocWinPriv)(pWin->drawable.pScreen)))
|
||||
{
|
||||
pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(sizeof(DbeWindowPrivRec));
|
||||
if (!pDbeWindowPriv)
|
||||
return(BadAlloc);
|
||||
}
|
||||
bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec));
|
||||
|
||||
/* Make the window priv a DBE window priv resource. */
|
||||
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
|
||||
|
@ -474,7 +327,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
|
||||
|
||||
/* Actually connect the window priv to the window. */
|
||||
pWin->devPrivates[dbeWindowPrivIndex].ptr = (pointer)pDbeWindowPriv;
|
||||
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
|
||||
|
||||
} /* if -- There is no buffer associated with the window. */
|
||||
|
||||
|
@ -1592,10 +1445,11 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
if (pDbeWindowPriv->nBufferIDs == 0)
|
||||
{
|
||||
/* Reset the DBE window priv pointer. */
|
||||
pDbeWindowPriv->pWindow->devPrivates[dbeWindowPrivIndex].ptr =
|
||||
(pointer)NULL;
|
||||
dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
|
||||
NULL);
|
||||
|
||||
/* We are done with the window priv. */
|
||||
dixFreePrivates(pDbeWindowPriv->devPrivates);
|
||||
xfree(pDbeWindowPriv);
|
||||
}
|
||||
|
||||
|
@ -1622,12 +1476,6 @@ DbeResetProc(ExtensionEntry *extEntry)
|
|||
ScreenPtr pScreen;
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
|
||||
|
||||
if (dbeScreenPrivIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
@ -1641,11 +1489,7 @@ DbeResetProc(ExtensionEntry *extEntry)
|
|||
if (pDbeScreenPriv->ResetProc)
|
||||
(*pDbeScreenPriv->ResetProc)(pScreen);
|
||||
|
||||
if (pDbeScreenPriv->winPrivPrivSizes)
|
||||
{
|
||||
xfree(pDbeScreenPriv->winPrivPrivSizes);
|
||||
}
|
||||
|
||||
dixFreePrivates(pDbeScreenPriv->devPrivates);
|
||||
xfree(pDbeScreenPriv);
|
||||
}
|
||||
}
|
||||
|
@ -1766,21 +1610,6 @@ DbeExtensionInit(void)
|
|||
if(!noPanoramiXExtension) return;
|
||||
#endif
|
||||
|
||||
/* Allocate private pointers in windows and screens. */
|
||||
|
||||
if ((dbeScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dbeWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize the priv priv counts between server generations. */
|
||||
winPrivPrivCount = 0;
|
||||
|
||||
/* Create the resource types. */
|
||||
dbeDrawableResType =
|
||||
CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
|
||||
|
@ -1795,8 +1624,7 @@ DbeExtensionInit(void)
|
|||
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
||||
if (!AllocateWindowPrivate(pScreen, dbeWindowPrivIndex, 0) ||
|
||||
!(pDbeScreenPriv =
|
||||
if (!(pDbeScreenPriv =
|
||||
(DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec))))
|
||||
{
|
||||
/* If we can not alloc a window or screen private,
|
||||
|
@ -1805,28 +1633,23 @@ DbeExtensionInit(void)
|
|||
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
xfree(screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr);
|
||||
screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr = NULL;
|
||||
xfree(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
|
||||
dbeScreenPrivKey));
|
||||
dixSetPrivate(&screenInfo.screens[j]->devPrivates,
|
||||
dbeScreenPrivKey, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pScreen->devPrivates[dbeScreenPrivIndex].ptr = (pointer)pDbeScreenPriv;
|
||||
|
||||
/* Store the DBE priv priv size info for later use when allocating
|
||||
* priv privs at the driver level.
|
||||
*/
|
||||
pDbeScreenPriv->winPrivPrivLen = 0;
|
||||
pDbeScreenPriv->winPrivPrivSizes = (unsigned *)NULL;
|
||||
pDbeScreenPriv->totalWinPrivSize = sizeof(DbeWindowPrivRec);
|
||||
dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv);
|
||||
|
||||
/* Copy the resource types */
|
||||
pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType;
|
||||
pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType;
|
||||
|
||||
/* Copy the private indices */
|
||||
pDbeScreenPriv->dbeScreenPrivIndex = dbeScreenPrivIndex;
|
||||
pDbeScreenPriv->dbeWindowPrivIndex = dbeWindowPrivIndex;
|
||||
pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey;
|
||||
pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey;
|
||||
|
||||
if(DbeInitFunct[i])
|
||||
{
|
||||
|
@ -1834,9 +1657,6 @@ DbeExtensionInit(void)
|
|||
|
||||
/* Setup DIX. */
|
||||
pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
|
||||
pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv;
|
||||
pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex;
|
||||
pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv;
|
||||
|
||||
/* Setup DDX. */
|
||||
ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv);
|
||||
|
@ -1868,9 +1688,6 @@ DbeExtensionInit(void)
|
|||
#ifndef DISABLE_MI_DBE_BY_DEFAULT
|
||||
/* Setup DIX. */
|
||||
pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter;
|
||||
pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv;
|
||||
pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex;
|
||||
pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv;
|
||||
|
||||
/* Setup DDX. */
|
||||
ddxInitSuccess = miDbeInit(pScreen, pDbeScreenPriv);
|
||||
|
@ -1909,8 +1726,9 @@ DbeExtensionInit(void)
|
|||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
xfree(screenInfo.screens[i]->devPrivates[dbeScreenPrivIndex].ptr);
|
||||
pScreen->devPrivates[dbeScreenPrivIndex].ptr = NULL;
|
||||
xfree(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
|
||||
dbeScreenPrivKey));
|
||||
dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,14 +39,13 @@
|
|||
#define NEED_DBE_PROTOCOL
|
||||
#include <X11/extensions/Xdbeproto.h>
|
||||
#include "windowstr.h"
|
||||
#include "privates.h"
|
||||
|
||||
|
||||
/* DEFINES */
|
||||
|
||||
#define DBE_SCREEN_PRIV(pScreen) \
|
||||
((dbeScreenPrivIndex < 0) ? \
|
||||
NULL : \
|
||||
((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr)))
|
||||
#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
|
||||
|
||||
#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
|
||||
DBE_SCREEN_PRIV((pDrawable)->pScreen)
|
||||
|
@ -63,10 +62,8 @@
|
|||
#define DBE_SCREEN_PRIV_FROM_GC(pGC)\
|
||||
DBE_SCREEN_PRIV((pGC)->pScreen)
|
||||
|
||||
#define DBE_WINDOW_PRIV(pWindow)\
|
||||
((dbeWindowPrivIndex < 0) ? \
|
||||
NULL : \
|
||||
((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr)))
|
||||
#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
|
||||
dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
|
||||
|
||||
/* Initial size of the buffer ID array in the window priv. */
|
||||
#define DBE_INIT_MAX_IDS 2
|
||||
|
@ -142,7 +139,7 @@ typedef struct _DbeWindowPrivRec
|
|||
|
||||
/* Device-specific private information.
|
||||
*/
|
||||
DevUnion *devPrivates;
|
||||
PrivateRec *devPrivates;
|
||||
|
||||
} DbeWindowPrivRec, *DbeWindowPrivPtr;
|
||||
|
||||
|
@ -155,18 +152,13 @@ typedef struct _DbeWindowPrivRec
|
|||
|
||||
typedef struct _DbeScreenPrivRec
|
||||
{
|
||||
/* Info for creating window privs */
|
||||
int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */
|
||||
unsigned int *winPrivPrivSizes; /* Array of private record sizes */
|
||||
unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */
|
||||
|
||||
/* Resources created by DIX to be used by DDX */
|
||||
RESTYPE dbeDrawableResType;
|
||||
RESTYPE dbeWindowPrivResType;
|
||||
|
||||
/* Private indices created by DIX to be used by DDX */
|
||||
int dbeScreenPrivIndex;
|
||||
int dbeWindowPrivIndex;
|
||||
DevPrivateKey dbeScreenPrivKey;
|
||||
DevPrivateKey dbeWindowPrivKey;
|
||||
|
||||
/* Wrapped functions
|
||||
* It is the responsibilty of the DDX layer to wrap PositionWindow().
|
||||
|
@ -180,17 +172,6 @@ typedef struct _DbeScreenPrivRec
|
|||
WindowPtr /*pWin*/,
|
||||
GCPtr /*pGC*/
|
||||
);
|
||||
DbeWindowPrivPtr (*AllocWinPriv)(
|
||||
ScreenPtr /*pScreen*/
|
||||
);
|
||||
int (*AllocWinPrivPrivIndex)(
|
||||
void
|
||||
);
|
||||
Bool (*AllocWinPrivPriv)(
|
||||
ScreenPtr /*pScreen*/,
|
||||
int /*index*/,
|
||||
unsigned /*amount*/
|
||||
);
|
||||
|
||||
/* Per-screen DDX routines */
|
||||
Bool (*GetVisualInfo)(
|
||||
|
@ -223,7 +204,7 @@ typedef struct _DbeScreenPrivRec
|
|||
|
||||
/* Device-specific private information.
|
||||
*/
|
||||
DevUnion *devPrivates;
|
||||
PrivateRec *devPrivates;
|
||||
|
||||
} DbeScreenPrivRec, *DbeScreenPrivPtr;
|
||||
|
||||
|
|
37
dbe/midbe.c
37
dbe/midbe.c
|
@ -59,12 +59,11 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
static int miDbePrivPrivGeneration = 0;
|
||||
static int miDbeWindowPrivPrivIndex = -1;
|
||||
static DevPrivateKey miDbeWindowPrivPrivKey = &miDbeWindowPrivPrivKey;
|
||||
static RESTYPE dbeDrawableResType;
|
||||
static RESTYPE dbeWindowPrivResType;
|
||||
static int dbeScreenPrivIndex = -1;
|
||||
static int dbeWindowPrivIndex = -1;
|
||||
static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKey;
|
||||
static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKey;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -204,8 +203,8 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
|
||||
|
||||
/* Attach the priv priv to the priv. */
|
||||
pDbeWindowPriv->devPrivates[miDbeWindowPrivPrivIndex].ptr =
|
||||
(pointer)pDbeWindowPrivPriv;
|
||||
dixSetPrivate(&pDbeWindowPriv->devPrivates, miDbeWindowPrivPrivKey,
|
||||
pDbeWindowPrivPriv);
|
||||
|
||||
|
||||
/* Clear the back buffer. */
|
||||
|
@ -778,30 +777,12 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
|
|||
dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType;
|
||||
|
||||
/* Copy private indices created by DIX */
|
||||
dbeScreenPrivIndex = pDbeScreenPriv->dbeScreenPrivIndex;
|
||||
dbeWindowPrivIndex = pDbeScreenPriv->dbeWindowPrivIndex;
|
||||
dbeScreenPrivKey = pDbeScreenPriv->dbeScreenPrivKey;
|
||||
dbeWindowPrivKey = pDbeScreenPriv->dbeWindowPrivKey;
|
||||
|
||||
/* Reset the window priv privs if generations do not match. */
|
||||
if (miDbePrivPrivGeneration != serverGeneration)
|
||||
{
|
||||
/*
|
||||
**********************************************************************
|
||||
** Allocate the window priv priv.
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)();
|
||||
|
||||
/* Make sure we only do this code once. */
|
||||
miDbePrivPrivGeneration = serverGeneration;
|
||||
|
||||
} /* if -- Reset priv privs. */
|
||||
|
||||
if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen,
|
||||
miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec)))
|
||||
{
|
||||
if (!dixRequestPrivate(miDbeWindowPrivPrivKey,
|
||||
sizeof(MiDbeWindowPrivPrivRec)))
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* Wrap functions. */
|
||||
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
|
||||
|
|
|
@ -42,19 +42,15 @@
|
|||
/* DEFINES */
|
||||
|
||||
#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
|
||||
(((miDbeWindowPrivPrivIndex < 0) || (!pDbeWindowPriv)) ? \
|
||||
NULL : \
|
||||
((MiDbeWindowPrivPrivPtr) \
|
||||
((pDbeWindowPriv)->devPrivates[miDbeWindowPrivPrivIndex].ptr)))
|
||||
(!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \
|
||||
dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey))
|
||||
|
||||
#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\
|
||||
MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin))
|
||||
|
||||
#define MI_DBE_SCREEN_PRIV_PRIV(pDbeScreenPriv) \
|
||||
(((miDbeScreenPrivPrivIndex < 0) || (!pDbeScreenPriv)) ? \
|
||||
NULL : \
|
||||
((MiDbeScreenPrivPrivPtr) \
|
||||
((pDbeScreenPriv)->devPrivates[miDbeScreenPrivPrivIndex].ptr)))
|
||||
(!(pDbeScreenPriv) ? NULL : (MiDbeScreenPrivPrivPtr) \
|
||||
dixLookupPrivate(&(pDbeScreenPriv)->devPrivates, miDbeScreenPrivPrivKey))
|
||||
|
||||
|
||||
/* TYPEDEFS */
|
||||
|
|
|
@ -67,7 +67,6 @@ SOFTWARE.
|
|||
#include "xace.h"
|
||||
|
||||
extern XID clientErrorValue;
|
||||
extern int colormapPrivateCount;
|
||||
|
||||
static Pixel FindBestPixel(
|
||||
EntryPtr /*pentFirst*/,
|
||||
|
@ -388,30 +387,11 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
pmap->numPixelsBlue[client] = size;
|
||||
}
|
||||
}
|
||||
if (!AddResource(mid, RT_COLORMAP, (pointer)pmap))
|
||||
return (BadAlloc);
|
||||
/* If the device wants a chance to initialize the colormap in any way,
|
||||
* this is it. In specific, if this is a Static colormap, this is the
|
||||
* time to fill in the colormap's values */
|
||||
pmap->devPrivates = NULL;
|
||||
pmap->flags |= BeingCreated;
|
||||
|
||||
|
||||
/*
|
||||
* Allocate the array of devPrivate's for this colormap.
|
||||
*/
|
||||
|
||||
if (colormapPrivateCount == 0)
|
||||
pmap->devPrivates = NULL;
|
||||
else
|
||||
{
|
||||
pmap->devPrivates = (DevUnion *) xcalloc (
|
||||
sizeof(DevUnion), colormapPrivateCount);
|
||||
if (!pmap->devPrivates)
|
||||
{
|
||||
FreeResource (mid, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
if (!AddResource(mid, RT_COLORMAP, (pointer)pmap))
|
||||
return (BadAlloc);
|
||||
|
||||
/*
|
||||
* Security creation/labeling check
|
||||
|
@ -423,6 +403,9 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
|
|||
return i;
|
||||
}
|
||||
|
||||
/* If the device wants a chance to initialize the colormap in any way,
|
||||
* this is it. In specific, if this is a Static colormap, this is the
|
||||
* time to fill in the colormap's values */
|
||||
if (!(*pScreen->CreateColormap)(pmap))
|
||||
{
|
||||
FreeResource (mid, RT_NONE);
|
||||
|
@ -486,10 +469,7 @@ FreeColormap (pointer value, XID mid)
|
|||
}
|
||||
}
|
||||
|
||||
dixFreePrivates(*DEVPRIV_PTR(pmap));
|
||||
if (pmap->devPrivates)
|
||||
xfree(pmap->devPrivates);
|
||||
|
||||
dixFreePrivates(pmap->devPrivates);
|
||||
xfree(pmap);
|
||||
return(Success);
|
||||
}
|
||||
|
|
|
@ -85,8 +85,7 @@ SOFTWARE.
|
|||
* This file handles input device-related stuff.
|
||||
*/
|
||||
|
||||
int CoreDevicePrivatesIndex = 0;
|
||||
static int CoreDevicePrivatesGeneration = -1;
|
||||
DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey;
|
||||
|
||||
/**
|
||||
* Create a new input device and init it to sane values. The device is added
|
||||
|
@ -151,14 +150,7 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
|
|||
dev->xkb_interest = NULL;
|
||||
#endif
|
||||
dev->config_info = NULL;
|
||||
/* must pre-allocate one private for the new devPrivates support */
|
||||
dev->nPrivates = 1;
|
||||
dev->devPrivates = (DevUnion *)xcalloc(1, sizeof(DevUnion));
|
||||
if (!dev->devPrivates) {
|
||||
xfree(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dev->devPrivates = NULL;
|
||||
dev->unwrapProc = NULL;
|
||||
dev->coreEvents = TRUE;
|
||||
dev->inited = FALSE;
|
||||
|
@ -358,7 +350,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
|
|||
break;
|
||||
|
||||
case DEVICE_CLOSE:
|
||||
pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
||||
dixSetPrivate(&pDev->devPrivates, CoreDevicePrivateKey, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -390,7 +382,7 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
|||
break;
|
||||
|
||||
case DEVICE_CLOSE:
|
||||
pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
||||
dixSetPrivate(&pDev->devPrivates, CoreDevicePrivateKey, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -411,11 +403,6 @@ InitCoreDevices(void)
|
|||
{
|
||||
DeviceIntPtr dev;
|
||||
|
||||
if (CoreDevicePrivatesGeneration != serverGeneration) {
|
||||
CoreDevicePrivatesIndex = AllocateDevicePrivateIndex();
|
||||
CoreDevicePrivatesGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
if (!inputInfo.keyboard) {
|
||||
dev = AddInputDevice(CoreKeyboardProc, TRUE);
|
||||
if (!dev)
|
||||
|
@ -433,9 +420,6 @@ InitCoreDevices(void)
|
|||
dev->ActivateGrab = ActivateKeyboardGrab;
|
||||
dev->DeactivateGrab = DeactivateKeyboardGrab;
|
||||
dev->coreEvents = FALSE;
|
||||
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
|
||||
FatalError("Couldn't allocate keyboard devPrivates\n");
|
||||
dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
||||
(void)ActivateDevice(dev);
|
||||
inputInfo.keyboard = dev;
|
||||
}
|
||||
|
@ -457,9 +441,6 @@ InitCoreDevices(void)
|
|||
dev->ActivateGrab = ActivatePointerGrab;
|
||||
dev->DeactivateGrab = DeactivatePointerGrab;
|
||||
dev->coreEvents = FALSE;
|
||||
if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
|
||||
FatalError("Couldn't allocate pointer devPrivates\n");
|
||||
dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
|
||||
(void)ActivateDevice(dev);
|
||||
inputInfo.pointer = dev;
|
||||
}
|
||||
|
@ -609,11 +590,8 @@ CloseDevice(DeviceIntPtr dev)
|
|||
XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
|
||||
#endif
|
||||
|
||||
dixFreePrivates(*DEVPRIV_PTR(dev));
|
||||
if (dev->devPrivates)
|
||||
xfree(dev->devPrivates);
|
||||
|
||||
xfree(dev->sync.event);
|
||||
dixFreePrivates(dev->devPrivates);
|
||||
xfree(dev);
|
||||
}
|
||||
|
||||
|
|
|
@ -3692,7 +3692,7 @@ CloseDownClient(ClientPtr client)
|
|||
#ifdef SMART_SCHEDULE
|
||||
SmartLastClient = NullClient;
|
||||
#endif
|
||||
dixFreePrivates(*DEVPRIV_PTR(client));
|
||||
dixFreePrivates(client->devPrivates);
|
||||
xfree(client);
|
||||
|
||||
while (!clients[currentMaxClients-1])
|
||||
|
@ -3712,10 +3712,6 @@ KillAllClients(void)
|
|||
}
|
||||
}
|
||||
|
||||
extern int clientPrivateLen;
|
||||
extern unsigned *clientPrivateSizes;
|
||||
extern unsigned totalClientSize;
|
||||
|
||||
void InitClient(ClientPtr client, int i, pointer ospriv)
|
||||
{
|
||||
client->index = i;
|
||||
|
@ -3735,6 +3731,7 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
|
|||
client->big_requests = FALSE;
|
||||
client->priority = 0;
|
||||
client->clientState = ClientStateInitial;
|
||||
client->devPrivates = NULL;
|
||||
#ifdef XKB
|
||||
if (!noXkbExtension) {
|
||||
client->xkbClientFlags = 0;
|
||||
|
@ -3755,54 +3752,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
InitClientPrivates(ClientPtr client)
|
||||
{
|
||||
char *ptr;
|
||||
DevUnion *ppriv;
|
||||
unsigned *sizes;
|
||||
unsigned size;
|
||||
int i;
|
||||
|
||||
if (totalClientSize == sizeof(ClientRec))
|
||||
ppriv = (DevUnion *)NULL;
|
||||
else if (client->index)
|
||||
ppriv = (DevUnion *)(client + 1);
|
||||
else
|
||||
{
|
||||
ppriv = (DevUnion *)xalloc(totalClientSize - sizeof(ClientRec));
|
||||
if (!ppriv)
|
||||
return 0;
|
||||
}
|
||||
client->devPrivates = ppriv;
|
||||
sizes = clientPrivateSizes;
|
||||
ptr = (char *)(ppriv + clientPrivateLen);
|
||||
if (ppriv)
|
||||
bzero(ppriv, totalClientSize - sizeof(ClientRec));
|
||||
for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ( (size = *sizes) )
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
|
||||
/* Allow registrants to initialize the serverClient devPrivates */
|
||||
if (!client->index && ClientStateCallback)
|
||||
{
|
||||
NewClientInfoRec clientinfo;
|
||||
|
||||
clientinfo.client = client;
|
||||
clientinfo.prefix = (xConnSetupPrefix *)NULL;
|
||||
clientinfo.setup = (xConnSetup *) NULL;
|
||||
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/************************
|
||||
* int NextAvailableClient(ospriv)
|
||||
*
|
||||
|
@ -3819,11 +3768,10 @@ ClientPtr NextAvailableClient(pointer ospriv)
|
|||
i = nextFreeClientID;
|
||||
if (i == MAXCLIENTS)
|
||||
return (ClientPtr)NULL;
|
||||
clients[i] = client = (ClientPtr)xalloc(totalClientSize);
|
||||
clients[i] = client = (ClientPtr)xalloc(sizeof(ClientRec));
|
||||
if (!client)
|
||||
return (ClientPtr)NULL;
|
||||
InitClient(client, i, ospriv);
|
||||
InitClientPrivates(client);
|
||||
if (!InitClientResources(client))
|
||||
{
|
||||
xfree(client);
|
||||
|
|
|
@ -73,39 +73,6 @@ int lastEvent = EXTENSION_EVENT_BASE;
|
|||
static int lastError = FirstExtensionError;
|
||||
static unsigned int NumExtensions = 0;
|
||||
|
||||
extern int extensionPrivateLen;
|
||||
extern unsigned *extensionPrivateSizes;
|
||||
extern unsigned totalExtensionSize;
|
||||
|
||||
static void
|
||||
InitExtensionPrivates(ExtensionEntry *ext)
|
||||
{
|
||||
char *ptr;
|
||||
DevUnion *ppriv;
|
||||
unsigned *sizes;
|
||||
unsigned size;
|
||||
int i;
|
||||
|
||||
if (totalExtensionSize == sizeof(ExtensionEntry))
|
||||
ppriv = (DevUnion *)NULL;
|
||||
else
|
||||
ppriv = (DevUnion *)(ext + 1);
|
||||
|
||||
ext->devPrivates = ppriv;
|
||||
sizes = extensionPrivateSizes;
|
||||
ptr = (char *)(ppriv + extensionPrivateLen);
|
||||
for (i = extensionPrivateLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ( (size = *sizes) )
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
_X_EXPORT ExtensionEntry *
|
||||
AddExtension(char *name, int NumEvents, int NumErrors,
|
||||
int (*MainProc)(ClientPtr c1),
|
||||
|
@ -122,14 +89,13 @@ AddExtension(char *name, int NumEvents, int NumErrors,
|
|||
(unsigned)(lastError + NumErrors > LAST_ERROR))
|
||||
return((ExtensionEntry *) NULL);
|
||||
|
||||
ext = (ExtensionEntry *) xalloc(totalExtensionSize);
|
||||
ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry));
|
||||
if (!ext)
|
||||
return((ExtensionEntry *) NULL);
|
||||
bzero(ext, totalExtensionSize);
|
||||
InitExtensionPrivates(ext);
|
||||
ext->name = (char *)xalloc(strlen(name) + 1);
|
||||
ext->num_aliases = 0;
|
||||
ext->aliases = (char **)NULL;
|
||||
ext->devPrivates = NULL;
|
||||
if (!ext->name)
|
||||
{
|
||||
xfree(ext);
|
||||
|
@ -283,7 +249,7 @@ CloseDownExtensions(void)
|
|||
for (j = extensions[i]->num_aliases; --j >= 0;)
|
||||
xfree(extensions[i]->aliases[j]);
|
||||
xfree(extensions[i]->aliases);
|
||||
dixFreePrivates(*DEVPRIV_PTR(extensions[i]));
|
||||
dixFreePrivates(extensions[i]->devPrivates);
|
||||
xfree(extensions[i]);
|
||||
}
|
||||
xfree(extensions);
|
||||
|
|
42
dix/gc.c
42
dix/gc.c
|
@ -573,45 +573,13 @@ BUG:
|
|||
should check for failure to create default tile
|
||||
|
||||
*/
|
||||
|
||||
static GCPtr
|
||||
AllocateGC(ScreenPtr pScreen)
|
||||
{
|
||||
GCPtr pGC;
|
||||
char *ptr;
|
||||
DevUnion *ppriv;
|
||||
unsigned *sizes;
|
||||
unsigned size;
|
||||
int i;
|
||||
|
||||
pGC = (GCPtr)xalloc(pScreen->totalGCSize);
|
||||
if (pGC)
|
||||
{
|
||||
ppriv = (DevUnion *)(pGC + 1);
|
||||
pGC->devPrivates = ppriv;
|
||||
sizes = pScreen->GCPrivateSizes;
|
||||
ptr = (char *)(ppriv + pScreen->GCPrivateLen);
|
||||
for (i = pScreen->GCPrivateLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ( (size = *sizes) )
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
}
|
||||
return pGC;
|
||||
}
|
||||
|
||||
_X_EXPORT GCPtr
|
||||
CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
|
||||
XID gcid, ClientPtr client)
|
||||
{
|
||||
GCPtr pGC;
|
||||
|
||||
pGC = AllocateGC(pDrawable->pScreen);
|
||||
pGC = (GCPtr)xalloc(sizeof(GC));
|
||||
if (!pGC)
|
||||
{
|
||||
*pStatus = BadAlloc;
|
||||
|
@ -624,7 +592,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
|
|||
pGC->planemask = ~0;
|
||||
pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
|
||||
pGC->funcs = 0;
|
||||
|
||||
pGC->devPrivates = NULL;
|
||||
pGC->fgPixel = 0;
|
||||
pGC->bgPixel = 1;
|
||||
pGC->lineWidth = 0;
|
||||
|
@ -918,7 +886,7 @@ FreeGC(pointer value, XID gid)
|
|||
(*pGC->funcs->DestroyGC) (pGC);
|
||||
if (pGC->dash != DefaultDash)
|
||||
xfree(pGC->dash);
|
||||
dixFreePrivates(*DEVPRIV_PTR(pGC));
|
||||
dixFreePrivates(pGC->devPrivates);
|
||||
xfree(pGC);
|
||||
return(Success);
|
||||
}
|
||||
|
@ -941,7 +909,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
|
|||
{
|
||||
GCPtr pGC;
|
||||
|
||||
pGC = AllocateGC(pScreen);
|
||||
pGC = (GCPtr)xalloc(sizeof(GC));
|
||||
if (!pGC)
|
||||
return (GCPtr)NULL;
|
||||
|
||||
|
@ -950,7 +918,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
|
|||
pGC->alu = GXcopy; /* dst <- src */
|
||||
pGC->planemask = ~0;
|
||||
pGC->serialNumber = 0;
|
||||
|
||||
pGC->devPrivates = NULL;
|
||||
pGC->fgPixel = 0;
|
||||
pGC->bgPixel = 1;
|
||||
pGC->lineWidth = 0;
|
||||
|
|
|
@ -725,7 +725,8 @@ SwitchCoreKeyboard(DeviceIntPtr pDev)
|
|||
KeyClassPtr ckeyc = inputInfo.keyboard->key;
|
||||
int i = 0;
|
||||
|
||||
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
|
||||
if (pDev != dixLookupPrivate(&inputInfo.keyboard->devPrivates,
|
||||
CoreDevicePrivateKey)) {
|
||||
memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
|
||||
if (ckeyc->modifierKeyMap)
|
||||
xfree(ckeyc->modifierKeyMap);
|
||||
|
@ -769,7 +770,8 @@ SwitchCoreKeyboard(DeviceIntPtr pDev)
|
|||
(ckeyc->curKeySyms.maxKeyCode -
|
||||
ckeyc->curKeySyms.minKeyCode),
|
||||
serverClient);
|
||||
inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
|
||||
dixSetPrivate(&inputInfo.keyboard->devPrivates, CoreDevicePrivateKey,
|
||||
pDev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,8 +785,10 @@ SwitchCoreKeyboard(DeviceIntPtr pDev)
|
|||
_X_EXPORT void
|
||||
SwitchCorePointer(DeviceIntPtr pDev)
|
||||
{
|
||||
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
|
||||
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
|
||||
if (pDev != dixLookupPrivate(&inputInfo.pointer->devPrivates,
|
||||
CoreDevicePrivateKey))
|
||||
dixSetPrivate(&inputInfo.pointer->devPrivates,
|
||||
CoreDevicePrivateKey, pDev);
|
||||
}
|
||||
|
||||
|
||||
|
|
54
dix/main.c
54
dix/main.c
|
@ -118,15 +118,12 @@ Equipment Corporation.
|
|||
#include "dpmsproc.h"
|
||||
#endif
|
||||
|
||||
extern int InitClientPrivates(ClientPtr client);
|
||||
|
||||
extern void Dispatch(void);
|
||||
|
||||
char *ConnectionInfo;
|
||||
xConnSetupPrefix connSetupPrefix;
|
||||
|
||||
extern FontPtr defaultFont;
|
||||
extern int screenPrivateCount;
|
||||
|
||||
extern void InitProcVectors(void);
|
||||
extern Bool CreateGCperDepthArray(void);
|
||||
|
@ -136,8 +133,6 @@ static
|
|||
#endif
|
||||
Bool CreateConnectionBlock(void);
|
||||
|
||||
static void FreeScreen(ScreenPtr);
|
||||
|
||||
_X_EXPORT PaddingInfo PixmapWidthPaddingInfo[33];
|
||||
|
||||
int connBlockScreenStart;
|
||||
|
@ -372,8 +367,6 @@ main(int argc, char *argv[], char *envp[])
|
|||
if (screenInfo.numVideoScreens < 0)
|
||||
screenInfo.numVideoScreens = screenInfo.numScreens;
|
||||
InitExtensions(argc, argv);
|
||||
if (!InitClientPrivates(serverClient))
|
||||
FatalError("failed to allocate serverClient devprivates");
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
|
@ -472,7 +465,8 @@ main(int argc, char *argv[], char *envp[])
|
|||
FreeGCperDepth(i);
|
||||
FreeDefaultStipple(i);
|
||||
(* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
|
||||
FreeScreen(screenInfo.screens[i]);
|
||||
dixFreePrivates(screenInfo.screens[i]->devPrivates);
|
||||
xfree(screenInfo.screens[i]);
|
||||
screenInfo.numScreens = i;
|
||||
}
|
||||
CloseDownEvents();
|
||||
|
@ -482,8 +476,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
|
||||
FreeAuditTimer();
|
||||
|
||||
dixFreePrivates(*DEVPRIV_PTR(serverClient));
|
||||
xfree(serverClient->devPrivates);
|
||||
dixFreePrivates(serverClient->devPrivates);
|
||||
serverClient->devPrivates = NULL;
|
||||
|
||||
if (dispatchException & DE_TERMINATE)
|
||||
|
@ -695,32 +688,9 @@ AddScreen(
|
|||
if (!pScreen)
|
||||
return -1;
|
||||
|
||||
pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion),
|
||||
screenPrivateCount);
|
||||
if (!pScreen->devPrivates && screenPrivateCount)
|
||||
{
|
||||
xfree(pScreen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* must pre-allocate one private for the new devPrivates support */
|
||||
pScreen->WindowPrivateLen = 1;
|
||||
pScreen->WindowPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
|
||||
pScreen->totalWindowSize = PadToLong(sizeof(WindowRec)) + sizeof(DevUnion);
|
||||
pScreen->GCPrivateLen = 1;
|
||||
pScreen->GCPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
|
||||
pScreen->totalGCSize = PadToLong(sizeof(GC)) + sizeof(DevUnion);
|
||||
pScreen->PixmapPrivateLen = 1;
|
||||
pScreen->PixmapPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
|
||||
pScreen->totalPixmapSize = BitmapBytePad(8 * (sizeof(PixmapRec) +
|
||||
sizeof(DevUnion)));
|
||||
if (!pScreen->WindowPrivateSizes || !pScreen->GCPrivateSizes ||
|
||||
!pScreen->PixmapPrivateSizes) {
|
||||
xfree(pScreen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pScreen->devPrivates = NULL;
|
||||
pScreen->myNum = i;
|
||||
pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
|
||||
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
|
||||
pScreen->CreateScreenResources = 0;
|
||||
|
||||
|
@ -772,20 +742,10 @@ AddScreen(
|
|||
screenInfo.numScreens++;
|
||||
if (!(*pfnInit)(i, pScreen, argc, argv))
|
||||
{
|
||||
FreeScreen(pScreen);
|
||||
dixFreePrivates(pScreen->devPrivates);
|
||||
xfree(pScreen);
|
||||
screenInfo.numScreens--;
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static void
|
||||
FreeScreen(ScreenPtr pScreen)
|
||||
{
|
||||
xfree(pScreen->WindowPrivateSizes);
|
||||
xfree(pScreen->GCPrivateSizes);
|
||||
xfree(pScreen->PixmapPrivateSizes);
|
||||
dixFreePrivates(*DEVPRIV_PTR(pScreen));
|
||||
xfree(pScreen->devPrivates);
|
||||
xfree(pScreen);
|
||||
}
|
||||
|
|
27
dix/pixmap.c
27
dix/pixmap.c
|
@ -109,11 +109,6 @@ _X_EXPORT PixmapPtr
|
|||
AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
char *ptr;
|
||||
DevUnion *ppriv;
|
||||
unsigned *sizes;
|
||||
unsigned size;
|
||||
int i;
|
||||
|
||||
if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
|
||||
return NullPixmap;
|
||||
|
@ -121,27 +116,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
|||
pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize);
|
||||
if (!pPixmap)
|
||||
return NullPixmap;
|
||||
ppriv = (DevUnion *)(pPixmap + 1);
|
||||
pPixmap->devPrivates = ppriv;
|
||||
sizes = pScreen->PixmapPrivateSizes;
|
||||
ptr = (char *)(ppriv + pScreen->PixmapPrivateLen);
|
||||
for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ((size = *sizes) != 0)
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
|
||||
#ifdef _XSERVER64
|
||||
if (pPixmap) {
|
||||
pPixmap->drawable.pad0 = 0;
|
||||
pPixmap->drawable.pad1 = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pPixmap->devPrivates = NULL;
|
||||
return pPixmap;
|
||||
}
|
||||
|
|
448
dix/privates.c
448
dix/privates.c
|
@ -30,21 +30,13 @@ from The Open Group.
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <stddef.h>
|
||||
#include "scrnintstr.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "windowstr.h"
|
||||
#include "resource.h"
|
||||
#include "privates.h"
|
||||
#include "dixstruct.h"
|
||||
#include "gcstruct.h"
|
||||
#include "colormapst.h"
|
||||
#include "servermd.h"
|
||||
#include "site.h"
|
||||
#include "inputstr.h"
|
||||
#include "extnsionst.h"
|
||||
|
||||
typedef struct _PrivateDesc {
|
||||
DevPrivateKey key;
|
||||
|
@ -218,18 +210,6 @@ dixLookupPrivateOffset(RESTYPE type)
|
|||
return offsets[type];
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from the main loop to reset the subsystem.
|
||||
*/
|
||||
static int ResetExtensionPrivates(void);
|
||||
static int ResetClientPrivates(void);
|
||||
static void ResetScreenPrivates(void);
|
||||
static void ResetWindowPrivates(void);
|
||||
static void ResetGCPrivates(void);
|
||||
static void ResetPixmapPrivates(void);
|
||||
static void ResetColormapPrivates(void);
|
||||
static void ResetDevicePrivateIndex(void);
|
||||
|
||||
int
|
||||
dixResetPrivates(void)
|
||||
{
|
||||
|
@ -251,16 +231,6 @@ dixResetPrivates(void)
|
|||
for (i=0; i < offsetsSize; i++)
|
||||
offsets[i] = -1;
|
||||
|
||||
/* reset legacy devPrivates support */
|
||||
if (!ResetExtensionPrivates() || !ResetClientPrivates())
|
||||
return FALSE;
|
||||
ResetScreenPrivates();
|
||||
ResetWindowPrivates();
|
||||
ResetGCPrivates();
|
||||
ResetPixmapPrivates();
|
||||
ResetColormapPrivates();
|
||||
ResetDevicePrivateIndex();
|
||||
|
||||
/* register basic resource offsets */
|
||||
return dixRegisterPrivateOffset(RT_WINDOW,
|
||||
offsetof(WindowRec, devPrivates)) &&
|
||||
|
@ -271,421 +241,3 @@ dixResetPrivates(void)
|
|||
dixRegisterPrivateOffset(RT_COLORMAP,
|
||||
offsetof(ColormapRec, devPrivates));
|
||||
}
|
||||
|
||||
/*
|
||||
* Following is the old devPrivates support. These functions and variables
|
||||
* are deprecated, and should no longer be used.
|
||||
*/
|
||||
|
||||
/*
|
||||
* See the Wrappers and devPrivates section in "Definition of the
|
||||
* Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms)
|
||||
* for information on how to use devPrivates.
|
||||
*/
|
||||
|
||||
/*
|
||||
* extension private machinery
|
||||
*/
|
||||
|
||||
static int extensionPrivateCount;
|
||||
int extensionPrivateLen;
|
||||
unsigned *extensionPrivateSizes;
|
||||
unsigned totalExtensionSize;
|
||||
|
||||
static int
|
||||
ResetExtensionPrivates(void)
|
||||
{
|
||||
extensionPrivateCount = 1;
|
||||
extensionPrivateLen = 1;
|
||||
xfree(extensionPrivateSizes);
|
||||
extensionPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
|
||||
if (!extensionPrivateSizes)
|
||||
return FALSE;
|
||||
totalExtensionSize = PadToLong(sizeof(ExtensionEntry)) + sizeof(DevUnion);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
AllocateExtensionPrivateIndex(void)
|
||||
{
|
||||
return extensionPrivateCount++;
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
AllocateExtensionPrivate(int index2, unsigned amount)
|
||||
{
|
||||
unsigned oldamount;
|
||||
|
||||
/* Round up sizes for proper alignment */
|
||||
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
|
||||
|
||||
if (index2 >= extensionPrivateLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(extensionPrivateSizes,
|
||||
(index2 + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
return FALSE;
|
||||
while (extensionPrivateLen <= index2)
|
||||
{
|
||||
nsizes[extensionPrivateLen++] = 0;
|
||||
totalExtensionSize += sizeof(DevUnion);
|
||||
}
|
||||
extensionPrivateSizes = nsizes;
|
||||
}
|
||||
oldamount = extensionPrivateSizes[index2];
|
||||
if (amount > oldamount)
|
||||
{
|
||||
extensionPrivateSizes[index2] = amount;
|
||||
totalExtensionSize += (amount - oldamount);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* client private machinery
|
||||
*/
|
||||
|
||||
static int clientPrivateCount;
|
||||
int clientPrivateLen;
|
||||
unsigned *clientPrivateSizes;
|
||||
unsigned totalClientSize;
|
||||
|
||||
static int
|
||||
ResetClientPrivates(void)
|
||||
{
|
||||
clientPrivateCount = 1;
|
||||
clientPrivateLen = 1;
|
||||
xfree(clientPrivateSizes);
|
||||
clientPrivateSizes = (unsigned *)xcalloc(1, sizeof(unsigned));
|
||||
if (!clientPrivateSizes)
|
||||
return FALSE;
|
||||
totalClientSize = PadToLong(sizeof(ClientRec)) + sizeof(DevUnion);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
AllocateClientPrivateIndex(void)
|
||||
{
|
||||
return clientPrivateCount++;
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
AllocateClientPrivate(int index2, unsigned amount)
|
||||
{
|
||||
unsigned oldamount;
|
||||
|
||||
/* Round up sizes for proper alignment */
|
||||
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
|
||||
|
||||
if (index2 >= clientPrivateLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(clientPrivateSizes,
|
||||
(index2 + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
return FALSE;
|
||||
while (clientPrivateLen <= index2)
|
||||
{
|
||||
nsizes[clientPrivateLen++] = 0;
|
||||
totalClientSize += sizeof(DevUnion);
|
||||
}
|
||||
clientPrivateSizes = nsizes;
|
||||
}
|
||||
oldamount = clientPrivateSizes[index2];
|
||||
if (amount > oldamount)
|
||||
{
|
||||
clientPrivateSizes[index2] = amount;
|
||||
totalClientSize += (amount - oldamount);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* screen private machinery
|
||||
*/
|
||||
|
||||
int screenPrivateCount;
|
||||
|
||||
static void
|
||||
ResetScreenPrivates(void)
|
||||
{
|
||||
screenPrivateCount = 1;
|
||||
}
|
||||
|
||||
/* this can be called after some screens have been created,
|
||||
* so we have to worry about resizing existing devPrivates
|
||||
*/
|
||||
_X_EXPORT int
|
||||
AllocateScreenPrivateIndex(void)
|
||||
{
|
||||
int idx;
|
||||
int i;
|
||||
ScreenPtr pScreen;
|
||||
DevUnion *nprivs;
|
||||
|
||||
idx = screenPrivateCount++;
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
pScreen = screenInfo.screens[i];
|
||||
nprivs = (DevUnion *)xrealloc(pScreen->devPrivates,
|
||||
screenPrivateCount * sizeof(DevUnion));
|
||||
if (!nprivs)
|
||||
{
|
||||
screenPrivateCount--;
|
||||
return -1;
|
||||
}
|
||||
/* Zero the new private */
|
||||
bzero(&nprivs[idx], sizeof(DevUnion));
|
||||
pScreen->devPrivates = nprivs;
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* window private machinery
|
||||
*/
|
||||
|
||||
static int windowPrivateCount;
|
||||
|
||||
static void
|
||||
ResetWindowPrivates(void)
|
||||
{
|
||||
windowPrivateCount = 1;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
AllocateWindowPrivateIndex(void)
|
||||
{
|
||||
return windowPrivateCount++;
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
AllocateWindowPrivate(ScreenPtr pScreen, int index2, unsigned amount)
|
||||
{
|
||||
unsigned oldamount;
|
||||
|
||||
/* Round up sizes for proper alignment */
|
||||
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
|
||||
|
||||
if (index2 >= pScreen->WindowPrivateLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes,
|
||||
(index2 + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
return FALSE;
|
||||
while (pScreen->WindowPrivateLen <= index2)
|
||||
{
|
||||
nsizes[pScreen->WindowPrivateLen++] = 0;
|
||||
pScreen->totalWindowSize += sizeof(DevUnion);
|
||||
}
|
||||
pScreen->WindowPrivateSizes = nsizes;
|
||||
}
|
||||
oldamount = pScreen->WindowPrivateSizes[index2];
|
||||
if (amount > oldamount)
|
||||
{
|
||||
pScreen->WindowPrivateSizes[index2] = amount;
|
||||
pScreen->totalWindowSize += (amount - oldamount);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gc private machinery
|
||||
*/
|
||||
|
||||
static int gcPrivateCount;
|
||||
|
||||
static void
|
||||
ResetGCPrivates(void)
|
||||
{
|
||||
gcPrivateCount = 1;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
AllocateGCPrivateIndex(void)
|
||||
{
|
||||
return gcPrivateCount++;
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
AllocateGCPrivate(ScreenPtr pScreen, int index2, unsigned amount)
|
||||
{
|
||||
unsigned oldamount;
|
||||
|
||||
/* Round up sizes for proper alignment */
|
||||
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
|
||||
|
||||
if (index2 >= pScreen->GCPrivateLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes,
|
||||
(index2 + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
return FALSE;
|
||||
while (pScreen->GCPrivateLen <= index2)
|
||||
{
|
||||
nsizes[pScreen->GCPrivateLen++] = 0;
|
||||
pScreen->totalGCSize += sizeof(DevUnion);
|
||||
}
|
||||
pScreen->GCPrivateSizes = nsizes;
|
||||
}
|
||||
oldamount = pScreen->GCPrivateSizes[index2];
|
||||
if (amount > oldamount)
|
||||
{
|
||||
pScreen->GCPrivateSizes[index2] = amount;
|
||||
pScreen->totalGCSize += (amount - oldamount);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pixmap private machinery
|
||||
*/
|
||||
static int pixmapPrivateCount;
|
||||
|
||||
static void
|
||||
ResetPixmapPrivates(void)
|
||||
{
|
||||
pixmapPrivateCount = 1;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
AllocatePixmapPrivateIndex(void)
|
||||
{
|
||||
return pixmapPrivateCount++;
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
AllocatePixmapPrivate(ScreenPtr pScreen, int index2, unsigned amount)
|
||||
{
|
||||
unsigned oldamount;
|
||||
|
||||
/* Round up sizes for proper alignment */
|
||||
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
|
||||
|
||||
if (index2 >= pScreen->PixmapPrivateLen)
|
||||
{
|
||||
unsigned *nsizes;
|
||||
nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes,
|
||||
(index2 + 1) * sizeof(unsigned));
|
||||
if (!nsizes)
|
||||
return FALSE;
|
||||
while (pScreen->PixmapPrivateLen <= index2)
|
||||
{
|
||||
nsizes[pScreen->PixmapPrivateLen++] = 0;
|
||||
pScreen->totalPixmapSize += sizeof(DevUnion);
|
||||
}
|
||||
pScreen->PixmapPrivateSizes = nsizes;
|
||||
}
|
||||
oldamount = pScreen->PixmapPrivateSizes[index2];
|
||||
if (amount > oldamount)
|
||||
{
|
||||
pScreen->PixmapPrivateSizes[index2] = amount;
|
||||
pScreen->totalPixmapSize += (amount - oldamount);
|
||||
}
|
||||
pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* colormap private machinery
|
||||
*/
|
||||
|
||||
int colormapPrivateCount;
|
||||
|
||||
static void
|
||||
ResetColormapPrivates(void)
|
||||
{
|
||||
colormapPrivateCount = 1;
|
||||
}
|
||||
|
||||
|
||||
_X_EXPORT int
|
||||
AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc)
|
||||
{
|
||||
int index;
|
||||
int i;
|
||||
ColormapPtr pColormap;
|
||||
DevUnion *privs;
|
||||
|
||||
index = colormapPrivateCount++;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
/*
|
||||
* AllocateColormapPrivateIndex may be called after the
|
||||
* default colormap has been created on each screen!
|
||||
*
|
||||
* We must resize the devPrivates array for the default
|
||||
* colormap on each screen, making room for this new private.
|
||||
* We also call the initialization function 'initPrivFunc' on
|
||||
* the new private allocated for each default colormap.
|
||||
*/
|
||||
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
|
||||
pColormap = (ColormapPtr) LookupIDByType (
|
||||
pScreen->defColormap, RT_COLORMAP);
|
||||
|
||||
if (pColormap)
|
||||
{
|
||||
privs = (DevUnion *) xrealloc (pColormap->devPrivates,
|
||||
colormapPrivateCount * sizeof(DevUnion));
|
||||
if (!privs) {
|
||||
colormapPrivateCount--;
|
||||
return -1;
|
||||
}
|
||||
bzero(&privs[index], sizeof(DevUnion));
|
||||
pColormap->devPrivates = privs;
|
||||
if (!(*initPrivFunc)(pColormap,index))
|
||||
{
|
||||
colormapPrivateCount--;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
* device private machinery
|
||||
*/
|
||||
|
||||
static int devicePrivateIndex = 0;
|
||||
|
||||
_X_EXPORT int
|
||||
AllocateDevicePrivateIndex(void)
|
||||
{
|
||||
return devicePrivateIndex++;
|
||||
}
|
||||
|
||||
_X_EXPORT Bool
|
||||
AllocateDevicePrivate(DeviceIntPtr device, int index)
|
||||
{
|
||||
if (device->nPrivates < ++index) {
|
||||
DevUnion *nprivs = (DevUnion *) xrealloc(device->devPrivates,
|
||||
index * sizeof(DevUnion));
|
||||
if (!nprivs)
|
||||
return FALSE;
|
||||
device->devPrivates = nprivs;
|
||||
bzero(&nprivs[device->nPrivates], sizeof(DevUnion)
|
||||
* (index - device->nPrivates));
|
||||
device->nPrivates = index;
|
||||
return TRUE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ResetDevicePrivateIndex(void)
|
||||
{
|
||||
devicePrivateIndex = 1;
|
||||
}
|
||||
|
|
43
dix/window.c
43
dix/window.c
|
@ -345,41 +345,6 @@ MakeRootTile(WindowPtr pWin)
|
|||
|
||||
}
|
||||
|
||||
WindowPtr
|
||||
AllocateWindow(ScreenPtr pScreen)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
char *ptr;
|
||||
DevUnion *ppriv;
|
||||
unsigned *sizes;
|
||||
unsigned size;
|
||||
int i;
|
||||
|
||||
pWin = (WindowPtr)xalloc(pScreen->totalWindowSize);
|
||||
if (pWin)
|
||||
{
|
||||
ppriv = (DevUnion *)(pWin + 1);
|
||||
pWin->devPrivates = ppriv;
|
||||
sizes = pScreen->WindowPrivateSizes;
|
||||
ptr = (char *)(ppriv + pScreen->WindowPrivateLen);
|
||||
for (i = pScreen->WindowPrivateLen; --i >= 0; ppriv++, sizes++)
|
||||
{
|
||||
if ( (size = *sizes) )
|
||||
{
|
||||
ppriv->ptr = (pointer)ptr;
|
||||
ptr += size;
|
||||
}
|
||||
else
|
||||
ppriv->ptr = (pointer)NULL;
|
||||
}
|
||||
#if _XSERVER64
|
||||
pWin->drawable.pad0 = 0;
|
||||
pWin->drawable.pad1 = 0;
|
||||
#endif
|
||||
}
|
||||
return pWin;
|
||||
}
|
||||
|
||||
/*****
|
||||
* CreateRootWindow
|
||||
* Makes a window at initialization time for specified screen
|
||||
|
@ -392,7 +357,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
|||
BoxRec box;
|
||||
PixmapFormatRec *format;
|
||||
|
||||
pWin = AllocateWindow(pScreen);
|
||||
pWin = (WindowPtr)xalloc(sizeof(WindowRec));
|
||||
if (!pWin)
|
||||
return FALSE;
|
||||
|
||||
|
@ -405,6 +370,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
|||
|
||||
pWin->drawable.pScreen = pScreen;
|
||||
pWin->drawable.type = DRAWABLE_WINDOW;
|
||||
pWin->devPrivates = NULL;
|
||||
|
||||
pWin->drawable.depth = pScreen->rootDepth;
|
||||
for (format = screenInfo.formats;
|
||||
|
@ -689,13 +655,14 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
|
|||
return NullWindow;
|
||||
}
|
||||
|
||||
pWin = AllocateWindow(pScreen);
|
||||
pWin = (WindowPtr)xalloc(sizeof(WindowRec));
|
||||
if (!pWin)
|
||||
{
|
||||
*error = BadAlloc;
|
||||
return NullWindow;
|
||||
}
|
||||
pWin->drawable = pParent->drawable;
|
||||
pWin->devPrivates = NULL;
|
||||
pWin->drawable.depth = depth;
|
||||
if (depth == pParent->drawable.depth)
|
||||
pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel;
|
||||
|
@ -968,7 +935,7 @@ DeleteWindow(pointer value, XID wid)
|
|||
if (pWin->prevSib)
|
||||
pWin->prevSib->nextSib = pWin->nextSib;
|
||||
}
|
||||
dixFreePrivates(*DEVPRIV_PTR(pWin));
|
||||
dixFreePrivates(pWin->devPrivates);
|
||||
xfree(pWin);
|
||||
return Success;
|
||||
}
|
||||
|
|
20
exa/exa.c
20
exa/exa.c
|
@ -40,9 +40,8 @@
|
|||
#include "exa.h"
|
||||
#include "cw.h"
|
||||
|
||||
static int exaGeneration;
|
||||
int exaScreenPrivateIndex;
|
||||
int exaPixmapPrivateIndex;
|
||||
DevPrivateKey exaScreenPrivateKey = &exaScreenPrivateKey;
|
||||
DevPrivateKey exaPixmapPrivateKey = &exaPixmapPrivateKey;
|
||||
|
||||
/**
|
||||
* exaGetPixmapOffset() returns the offset (in bytes) within the framebuffer of
|
||||
|
@ -619,12 +618,6 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
#ifdef RENDER
|
||||
ps = GetPictureScreenIfSet(pScreen);
|
||||
#endif
|
||||
if (exaGeneration != serverGeneration)
|
||||
{
|
||||
exaScreenPrivateIndex = AllocateScreenPrivateIndex();
|
||||
exaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
|
||||
exaGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
|
||||
|
||||
|
@ -636,7 +629,7 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
|
||||
pExaScr->info = pScreenInfo;
|
||||
|
||||
pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr;
|
||||
dixSetPrivate(&pScreen->devPrivates, exaScreenPrivateKey, pExaScr);
|
||||
|
||||
pExaScr->migration = ExaMigrationAlways;
|
||||
|
||||
|
@ -698,8 +691,7 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
|
||||
pExaScr->info->offScreenBase < pExaScr->info->memorySize)
|
||||
{
|
||||
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex,
|
||||
sizeof (ExaPixmapPrivRec))) {
|
||||
if (!dixRequestPrivate(exaPixmapPrivateKey, sizeof(ExaPixmapPrivRec))) {
|
||||
LogMessage(X_WARNING,
|
||||
"EXA(%d): Failed to allocate pixmap private\n",
|
||||
pScreen->myNum);
|
||||
|
@ -716,11 +708,7 @@ exaDriverInit (ScreenPtr pScreen,
|
|||
pExaScr->info->memorySize - pExaScr->info->offScreenBase);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage(X_INFO, "EXA(%d): No offscreen pixmaps\n", pScreen->myNum);
|
||||
if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
|
||||
pExaScr->info->memorySize));
|
||||
|
|
|
@ -132,9 +132,9 @@ typedef struct {
|
|||
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
|
||||
#endif
|
||||
|
||||
extern int exaScreenPrivateIndex;
|
||||
extern int exaPixmapPrivateIndex;
|
||||
#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)(s)->devPrivates[exaScreenPrivateIndex].ptr)
|
||||
extern DevPrivateKey exaScreenPrivateKey;
|
||||
extern DevPrivateKey exaPixmapPrivateKey;
|
||||
#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey))
|
||||
#define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s)
|
||||
|
||||
/** Align an offset to an arbitrary alignment */
|
||||
|
@ -150,8 +150,8 @@ extern int exaPixmapPrivateIndex;
|
|||
#define EXA_PIXMAP_SCORE_PINNED 1000
|
||||
#define EXA_PIXMAP_SCORE_INIT 1001
|
||||
|
||||
#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)(p)->devPrivates[exaPixmapPrivateIndex].ptr)
|
||||
#define ExaSetPixmapPriv(p,a) ((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a))
|
||||
#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey))
|
||||
#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a)
|
||||
#define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p)
|
||||
|
||||
typedef struct {
|
||||
|
|
20
fb/fb.h
20
fb/fb.h
|
@ -37,6 +37,7 @@
|
|||
#include "miscstruct.h"
|
||||
#include "servermd.h"
|
||||
#include "windowstr.h"
|
||||
#include "privates.h"
|
||||
#include "mi.h"
|
||||
#include "migc.h"
|
||||
#include "mibstore.h"
|
||||
|
@ -599,13 +600,9 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
|
|||
} \
|
||||
}
|
||||
|
||||
/* XXX fb*PrivateIndex should be static, but it breaks the ABI */
|
||||
|
||||
extern int fbGCPrivateIndex;
|
||||
extern int fbGetGCPrivateIndex(void);
|
||||
extern DevPrivateKey fbGetGCPrivateKey(void);
|
||||
#ifndef FB_NO_WINDOW_PIXMAPS
|
||||
extern int fbWinPrivateIndex;
|
||||
extern int fbGetWinPrivateIndex(void);
|
||||
extern DevPrivateKey fbGetWinPrivateKey(void);
|
||||
#endif
|
||||
extern const GCOps fbGCOps;
|
||||
extern const GCFuncs fbGCFuncs;
|
||||
|
@ -641,8 +638,7 @@ typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
|
|||
|
||||
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
extern int fbScreenPrivateIndex;
|
||||
extern int fbGetScreenPrivateIndex(void);
|
||||
extern DevPrivateKey fbGetScreenPrivateKey(void);
|
||||
|
||||
/* private field of a screen */
|
||||
typedef struct {
|
||||
|
@ -655,7 +651,7 @@ typedef struct {
|
|||
} FbScreenPrivRec, *FbScreenPrivPtr;
|
||||
|
||||
#define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
|
||||
(pScreen)->devPrivates[fbGetScreenPrivateIndex()].ptr)
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, fbGetScreenPrivateKey()))
|
||||
#endif
|
||||
|
||||
/* private field of GC */
|
||||
|
@ -670,7 +666,7 @@ typedef struct {
|
|||
} FbGCPrivRec, *FbGCPrivPtr;
|
||||
|
||||
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
|
||||
(pGC)->devPrivates[fbGetGCPrivateIndex()].ptr)
|
||||
dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey()))
|
||||
|
||||
#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
|
||||
#define fbGetExpose(pGC) ((pGC)->fExpose)
|
||||
|
@ -682,7 +678,7 @@ typedef struct {
|
|||
#define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen)
|
||||
#else
|
||||
#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
|
||||
((WindowPtr) (pWin))->devPrivates[fbGetWinPrivateIndex()].ptr)
|
||||
dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey()))
|
||||
#endif
|
||||
|
||||
#ifdef ROOTLESS
|
||||
|
@ -835,7 +831,7 @@ fb24_32ModifyPixmapHeader (PixmapPtr pPixmap,
|
|||
* fballpriv.c
|
||||
*/
|
||||
Bool
|
||||
fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex);
|
||||
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex);
|
||||
|
||||
/*
|
||||
* fbarc.c
|
||||
|
|
|
@ -27,51 +27,33 @@
|
|||
#include "fb.h"
|
||||
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
int fbScreenPrivateIndex;
|
||||
int fbGetScreenPrivateIndex(void)
|
||||
static DevPrivateKey fbScreenPrivateKey = &fbScreenPrivateKey;
|
||||
DevPrivateKey fbGetScreenPrivateKey(void)
|
||||
{
|
||||
return fbScreenPrivateIndex;
|
||||
return fbScreenPrivateKey;
|
||||
}
|
||||
#endif
|
||||
int fbGCPrivateIndex;
|
||||
int fbGetGCPrivateIndex(void)
|
||||
static DevPrivateKey fbGCPrivateKey = &fbGCPrivateKey;
|
||||
DevPrivateKey fbGetGCPrivateKey(void)
|
||||
{
|
||||
return fbGCPrivateIndex;
|
||||
return fbGCPrivateKey;
|
||||
}
|
||||
#ifndef FB_NO_WINDOW_PIXMAPS
|
||||
int fbWinPrivateIndex;
|
||||
int fbGetWinPrivateIndex(void)
|
||||
static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKey;
|
||||
DevPrivateKey fbGetWinPrivateKey(void)
|
||||
{
|
||||
return fbWinPrivateIndex;
|
||||
return fbWinPrivateKey;
|
||||
}
|
||||
#endif
|
||||
int fbGeneration;
|
||||
|
||||
Bool
|
||||
fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
|
||||
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
|
||||
{
|
||||
if (fbGeneration != serverGeneration)
|
||||
{
|
||||
fbGCPrivateIndex = miAllocateGCPrivateIndex ();
|
||||
#ifndef FB_NO_WINDOW_PIXMAPS
|
||||
fbWinPrivateIndex = AllocateWindowPrivateIndex();
|
||||
#endif
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
fbScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
if (fbScreenPrivateIndex == -1)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
fbGeneration = serverGeneration;
|
||||
}
|
||||
if (pGCIndex)
|
||||
*pGCIndex = fbGCPrivateIndex;
|
||||
if (!AllocateGCPrivate(pScreen, fbGCPrivateIndex, sizeof(FbGCPrivRec)))
|
||||
if (pGCKey)
|
||||
*pGCKey = fbGCPrivateKey;
|
||||
|
||||
if (!dixRequestPrivate(fbGCPrivateKey, sizeof(FbGCPrivRec)))
|
||||
return FALSE;
|
||||
#ifndef FB_NO_WINDOW_PIXMAPS
|
||||
if (!AllocateWindowPrivate(pScreen, fbWinPrivateIndex, 0))
|
||||
return FALSE;
|
||||
#endif
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
{
|
||||
FbScreenPrivPtr pScreenPriv;
|
||||
|
@ -79,7 +61,7 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
|
|||
pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec));
|
||||
if (!pScreenPriv)
|
||||
return FALSE;
|
||||
pScreen->devPrivates[fbScreenPrivateIndex].ptr = (pointer) pScreenPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
|
|
|
@ -33,12 +33,11 @@
|
|||
#include "fboverlay.h"
|
||||
#include "shmint.h"
|
||||
|
||||
int fbOverlayGeneration;
|
||||
int fbOverlayScreenPrivateIndex = -1;
|
||||
static DevPrivateKey fbOverlayScreenPrivateKey = &fbOverlayScreenPrivateKey;
|
||||
|
||||
int fbOverlayGetScreenPrivateIndex(void)
|
||||
DevPrivateKey fbOverlayGetScreenPrivateKey(void)
|
||||
{
|
||||
return fbOverlayScreenPrivateIndex;
|
||||
return fbOverlayScreenPrivateKey;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -65,7 +64,7 @@ fbOverlayCreateWindow(WindowPtr pWin)
|
|||
pPixmap = pScrPriv->layer[i].u.run.pixmap;
|
||||
if (pWin->drawable.depth == pPixmap->drawable.depth)
|
||||
{
|
||||
pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap;
|
||||
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
|
||||
/*
|
||||
* Make sure layer keys are written correctly by
|
||||
* having non-root layers set to full while the
|
||||
|
@ -108,7 +107,7 @@ fbOverlayWindowLayer(WindowPtr pWin)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < pScrPriv->nlayers; i++)
|
||||
if (pWin->devPrivates[fbWinPrivateIndex].ptr ==
|
||||
if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) ==
|
||||
(pointer) pScrPriv->layer[i].u.run.pixmap)
|
||||
return i;
|
||||
return 0;
|
||||
|
@ -358,12 +357,6 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
VisualID defaultVisual;
|
||||
FbOverlayScrPrivPtr pScrPriv;
|
||||
|
||||
if (fbOverlayGeneration != serverGeneration)
|
||||
{
|
||||
fbOverlayScreenPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
fbOverlayGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec));
|
||||
if (!pScrPriv)
|
||||
return FALSE;
|
||||
|
@ -433,7 +426,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
|
|||
pScrPriv->layer[1].u.init.width = width2;
|
||||
pScrPriv->layer[1].u.init.depth = depth2;
|
||||
|
||||
pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (pointer) pScrPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, fbOverlayScreenPrivateKey, pScrPriv);
|
||||
|
||||
/* overwrite miCloseScreen with our own */
|
||||
pScreen->CloseScreen = fbOverlayCloseScreen;
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#ifndef _FBOVERLAY_H_
|
||||
#define _FBOVERLAY_H_
|
||||
|
||||
extern int fbOverlayGeneration;
|
||||
extern int fbOverlayScreenPrivateIndex; /* XXX should be static */
|
||||
extern int fbOverlayGetScreenPrivateIndex(void);
|
||||
#include "privates.h"
|
||||
|
||||
extern DevPrivateKey fbOverlayGetScreenPrivateKey(void);
|
||||
|
||||
#ifndef FB_OVERLAY_MAX
|
||||
#define FB_OVERLAY_MAX 2
|
||||
|
@ -58,8 +58,7 @@ typedef struct _fbOverlayScrPriv {
|
|||
} FbOverlayScrPrivRec, *FbOverlayScrPrivPtr;
|
||||
|
||||
#define fbOverlayGetScrPriv(s) \
|
||||
((fbOverlayGetScreenPrivateIndex() != -1) ? \
|
||||
(s)->devPrivates[fbOverlayGetScreenPrivateIndex()].ptr : NULL)
|
||||
dixLookupPrivate(&(s)->devPrivates, fbOverlayGetScreenPrivateKey())
|
||||
Bool
|
||||
fbOverlayCreateWindow(WindowPtr pWin);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ fbDestroyPixmap (PixmapPtr pPixmap)
|
|||
{
|
||||
if(--pPixmap->refcnt)
|
||||
return TRUE;
|
||||
dixFreePrivates(*DEVPRIV_PTR(pPixmap));
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -125,13 +125,11 @@ typedef struct {
|
|||
} xxScrPrivRec, *xxScrPrivPtr;
|
||||
|
||||
#define xxGetScrPriv(s) ((xxScrPrivPtr) \
|
||||
(xxScrPrivateIndex != -1) \
|
||||
? (s)->devPrivates[xxScrPrivateIndex].ptr\
|
||||
: NULL)
|
||||
dixLookupPrivate(&(s)->devPrivates, xxScrPrivateKey))
|
||||
#define xxScrPriv(s) xxScrPrivPtr pScrPriv = xxGetScrPriv(s)
|
||||
|
||||
#define xxGetCmapPriv(s) ((xxCmapPrivPtr) \
|
||||
(s)->devPrivates[xxColormapPrivateIndex].ptr)
|
||||
dixLookupPrivate(&(s)->devPrivates, xxColormapPrivateKey))
|
||||
#define xxCmapPriv(s) xxCmapPrivPtr pCmapPriv = xxGetCmapPriv(s);
|
||||
|
||||
typedef struct _xxGCPriv {
|
||||
|
@ -140,13 +138,12 @@ typedef struct _xxGCPriv {
|
|||
} xxGCPrivRec, *xxGCPrivPtr;
|
||||
|
||||
#define xxGetGCPriv(pGC) ((xxGCPrivPtr) \
|
||||
(pGC)->devPrivates[xxGCPrivateIndex].ptr)
|
||||
dixLookupPrivate(&(pGC)->devPrivates, xxGCPrivateKey))
|
||||
#define xxGCPriv(pGC) xxGCPrivPtr pGCPriv = xxGetGCPriv(pGC)
|
||||
|
||||
int xxScrPrivateIndex = -1;
|
||||
int xxGCPrivateIndex;
|
||||
int xxColormapPrivateIndex = -1;
|
||||
int xxGeneration;
|
||||
static DevPrivateKey xxScrPrivateKey = &xxScrPrivateKey;
|
||||
static DevPrivateKey xxGCPrivateKey = &xxGCPrivateKey;
|
||||
static DevPrivateKey xxColormapPrivateKey = &xxColormapPrivateKey;
|
||||
|
||||
|
||||
#define wrap(priv,real,mem,func) {\
|
||||
|
@ -355,12 +352,6 @@ xxMyVisual(ScreenPtr pScreen, VisualID vid)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xxInitColormapDummy(ColormapPtr pmap, int index)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
xxInitColormapPrivate(ColormapPtr pmap)
|
||||
{
|
||||
|
@ -368,14 +359,14 @@ xxInitColormapPrivate(ColormapPtr pmap)
|
|||
xxCmapPrivPtr pCmapPriv;
|
||||
pointer cmap;
|
||||
|
||||
pmap->devPrivates[xxColormapPrivateIndex].ptr = (pointer) -1;
|
||||
dixSetPrivate(&pmap->devPrivates, xxColormapPrivateKey, (pointer) -1);
|
||||
|
||||
if (xxMyVisual(pmap->pScreen,pmap->pVisual->vid)) {
|
||||
DBG("CreateColormap\n");
|
||||
pCmapPriv = (xxCmapPrivPtr) xalloc (sizeof (xxCmapPrivRec));
|
||||
if (!pCmapPriv)
|
||||
return FALSE;
|
||||
pmap->devPrivates[xxColormapPrivateIndex].ptr = (pointer) pCmapPriv;
|
||||
dixSetPrivate(&pmap->devPrivates, xxColormapPrivateKey, pCmapPriv);
|
||||
cmap = xalloc(sizeof (CARD32) * (1 << pScrPriv->myDepth));
|
||||
if (!cmap)
|
||||
return FALSE;
|
||||
|
@ -677,7 +668,7 @@ xxCreateWindow(WindowPtr pWin)
|
|||
|
||||
DBG("CreateWindow\n");
|
||||
|
||||
pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pScrPriv->pPixmap;
|
||||
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pScrPriv->pPixmap);
|
||||
PRINT_RECTS(pScrPriv->region);
|
||||
if (!pWin->parent) {
|
||||
REGION_EMPTY (pWin->drawable.pScreen, &pScrPriv->region);
|
||||
|
@ -746,9 +737,10 @@ xxCopyWindow(WindowPtr pWin,
|
|||
xxPickMyWindows(pWin,&rgn);
|
||||
|
||||
unwrap (pScrPriv, pScreen, CopyWindow);
|
||||
pWin->devPrivates[fbWinPrivateIndex].ptr = fbGetScreenPixmap(pScreen);
|
||||
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(),
|
||||
fbGetScreenPixmap(pScreen));
|
||||
pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
|
||||
pWin->devPrivates[fbWinPrivateIndex].ptr = pPixmap;
|
||||
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap);
|
||||
wrap(pScrPriv, pScreen, CopyWindow, xxCopyWindow);
|
||||
|
||||
REGION_INTERSECT(pScreen,&rgn,&rgn,&rgn_new);
|
||||
|
@ -1098,21 +1090,7 @@ xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sy
|
|||
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
|
||||
#endif
|
||||
|
||||
if (xxGeneration != serverGeneration) {
|
||||
xxScrPrivateIndex = AllocateScreenPrivateIndex ();
|
||||
if (xxScrPrivateIndex == -1)
|
||||
return FALSE;
|
||||
xxColormapPrivateIndex
|
||||
= AllocateColormapPrivateIndex (xxInitColormapDummy);
|
||||
if (xxColormapPrivateIndex == -1)
|
||||
return FALSE;
|
||||
xxGCPrivateIndex = AllocateGCPrivateIndex ();
|
||||
if (xxGCPrivateIndex == -1)
|
||||
return FALSE;
|
||||
xxGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
if (!AllocateGCPrivate (pScreen, xxGCPrivateIndex, sizeof (xxGCPrivRec)))
|
||||
if (!dixRequestPrivate(xxGCPrivateKey, sizeof (xxGCPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
pScrPriv = (xxScrPrivPtr) xalloc (sizeof (xxScrPrivRec));
|
||||
|
@ -1190,7 +1168,7 @@ xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sy
|
|||
}
|
||||
#endif
|
||||
pScrPriv->addr = addr;
|
||||
pScreen->devPrivates[xxScrPrivateIndex].ptr = (pointer) pScrPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, xxScrPrivateKey, pScrPriv);
|
||||
|
||||
pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
|
||||
if (!xxInitColormapPrivate(pDefMap))
|
||||
|
|
|
@ -38,7 +38,7 @@ fbCloseScreen (int index, ScreenPtr pScreen)
|
|||
xfree (pScreen->visuals);
|
||||
xfree (pScreen->devPrivate);
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
xfree (pScreen->devPrivates[fbScreenPrivateIndex].ptr);
|
||||
xfree (dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
|
|||
#ifdef FB_NO_WINDOW_PIXMAPS
|
||||
FatalError ("Attempted to set window pixmap without fb support\n");
|
||||
#else
|
||||
pWindow->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap;
|
||||
dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ fbSetupScreen(ScreenPtr pScreen,
|
|||
int width, /* pixel width of frame buffer */
|
||||
int bpp) /* bits per pixel for screen */
|
||||
{
|
||||
if (!fbAllocatePrivates(pScreen, (int *) 0))
|
||||
if (!fbAllocatePrivates(pScreen, NULL))
|
||||
return FALSE;
|
||||
pScreen->defColormap = FakeClientID(0);
|
||||
/* let CreateDefColormap do whatever it wants for pixels */
|
||||
|
|
|
@ -32,8 +32,8 @@ Bool
|
|||
fbCreateWindow(WindowPtr pWin)
|
||||
{
|
||||
#ifndef FB_NO_WINDOW_PIXMAPS
|
||||
pWin->devPrivates[fbWinPrivateIndex].ptr =
|
||||
(pointer) fbGetScreenPixmap(pWin->drawable.pScreen);
|
||||
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(),
|
||||
fbGetScreenPixmap(pWin->drawable.pScreen));
|
||||
#endif
|
||||
#ifdef FB_SCREEN_PRIVATE
|
||||
if (pWin->drawable.bitsPerPixel == 32)
|
||||
|
|
|
@ -84,14 +84,14 @@
|
|||
#define fbFixCoordModePrevious wfbFixCoordModePrevious
|
||||
#define fbGCFuncs wfbGCFuncs
|
||||
#define fbGCOps wfbGCOps
|
||||
#define fbGCPrivateIndex wfbGCPrivateIndex
|
||||
#define fbGCPrivateKey wfbGCPrivateKey
|
||||
#define fbGeneration wfbGeneration
|
||||
#define fbGetGCPrivateIndex wfbGetGCPrivateIndex
|
||||
#define fbGetGCPrivateKey wfbGetGCPrivateKey
|
||||
#define fbGetImage wfbGetImage
|
||||
#define fbGetScreenPrivateIndex wfbGetScreenPrivateIndex
|
||||
#define fbGetScreenPrivateKey wfbGetScreenPrivateKey
|
||||
#define fbGetSpans wfbGetSpans
|
||||
#define _fbGetWindowPixmap _wfbGetWindowPixmap
|
||||
#define fbGetWinPrivateIndex wfbGetWinPrivateIndex
|
||||
#define fbGetWinPrivateKey wfbGetWinPrivateKey
|
||||
#define fbGlyph16 wfbGlyph16
|
||||
#define fbGlyph24 wfbGlyph24
|
||||
#define fbGlyph32 wfbGlyph32
|
||||
|
@ -117,10 +117,10 @@
|
|||
#define fbOverlayCreateWindow wfbOverlayCreateWindow
|
||||
#define fbOverlayFinishScreenInit wfbOverlayFinishScreenInit
|
||||
#define fbOverlayGeneration wfbOverlayGeneration
|
||||
#define fbOverlayGetScreenPrivateIndex wfbOverlayGetScreenPrivateIndex
|
||||
#define fbOverlayGetScreenPrivateKey wfbOverlayGetScreenPrivateKey
|
||||
#define fbOverlayPaintKey wfbOverlayPaintKey
|
||||
#define fbOverlayPaintWindow wfbOverlayPaintWindow
|
||||
#define fbOverlayScreenPrivateIndex wfbOverlayScreenPrivateIndex
|
||||
#define fbOverlayScreenPrivateKey wfbOverlayScreenPrivateKey
|
||||
#define fbOverlaySetupScreen wfbOverlaySetupScreen
|
||||
#define fbOverlayUpdateLayerRegion wfbOverlayUpdateLayerRegion
|
||||
#define fbOverlayWindowExposures wfbOverlayWindowExposures
|
||||
|
@ -160,7 +160,7 @@
|
|||
#define fbResolveColor wfbResolveColor
|
||||
#define fbRestoreAreas wfbRestoreAreas
|
||||
#define fbSaveAreas wfbSaveAreas
|
||||
#define fbScreenPrivateIndex wfbScreenPrivateIndex
|
||||
#define fbScreenPrivateKey wfbScreenPrivateKey
|
||||
#define fbSegment wfbSegment
|
||||
#define fbSelectBres wfbSelectBres
|
||||
#define fbSetSpans wfbSetSpans
|
||||
|
@ -185,14 +185,14 @@
|
|||
#define fbUnrealizeFont wfbUnrealizeFont
|
||||
#define fbValidateGC wfbValidateGC
|
||||
#define fbWalkCompositeRegion wfbWalkCompositeRegion
|
||||
#define fbWinPrivateIndex wfbWinPrivateIndex
|
||||
#define fbWinPrivateKey wfbWinPrivateKey
|
||||
#define fbZeroLine wfbZeroLine
|
||||
#define fbZeroSegment wfbZeroSegment
|
||||
#define free_pixman_pict wfb_free_pixman_pict
|
||||
#define image_from_pict wfb_image_from_pict
|
||||
#define xxScrPrivateIndex wfbxxScrPrivateIndex
|
||||
#define xxGCPrivateIndex wfbxxGCPrivateIndex
|
||||
#define xxColormapPrivateIndex wfbxxColormapPrivateIndex
|
||||
#define xxScrPrivateKey wfbxxScrPrivateKey
|
||||
#define xxGCPrivateKey wfbxxGCPrivateKey
|
||||
#define xxColormapPrivateKey wfbxxColormapPrivateKey
|
||||
#define xxGeneration wfbxxGeneration
|
||||
#define xxPrintVisuals wfbxxPrintVisuals
|
||||
#define xxGCFuncs wfbxxGCFuncs
|
||||
|
|
|
@ -88,8 +88,8 @@ void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
|
|||
#define kern_assert(x) { if ((x) != KERN_SUCCESS) \
|
||||
FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \
|
||||
__LINE__, __FILE__, x); }
|
||||
#define SCREEN_PRIV(pScreen) \
|
||||
((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr)
|
||||
#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, darwinScreenKey))
|
||||
|
||||
|
||||
#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
|
||||
|
@ -98,7 +98,7 @@ void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class);
|
|||
/*
|
||||
* Global variables from darwin.c
|
||||
*/
|
||||
extern int darwinScreenIndex; // index into pScreen.devPrivates
|
||||
extern DevPrivateKey darwinScreenKey; // index into pScreen.devPrivates
|
||||
extern int darwinScreensFound;
|
||||
extern io_connect_t darwinParamConnect;
|
||||
extern int darwinEventReadFD;
|
||||
|
|
|
@ -45,10 +45,10 @@ typedef struct {
|
|||
unsigned char *shadowPtr;
|
||||
} XFIOKitScreenRec, *XFIOKitScreenPtr;
|
||||
|
||||
#define XFIOKIT_SCREEN_PRIV(pScreen) \
|
||||
((XFIOKitScreenPtr)pScreen->devPrivates[xfIOKitScreenIndex].ptr)
|
||||
#define XFIOKIT_SCREEN_PRIV(pScreen) ((XFIOKitScreenPtr) \
|
||||
dixLookupPrivate(&pScreen->devPrivates, xfIOKitScreenKey))
|
||||
|
||||
extern int xfIOKitScreenIndex; // index into pScreen.devPrivates
|
||||
extern DevPrivateKey xfIOKitScreenKey; // index into pScreen.devPrivates
|
||||
extern io_connect_t xfIOKitInputConnect;
|
||||
|
||||
Bool XFIOKitInitCursor(ScreenPtr pScreen);
|
||||
|
|
|
@ -73,8 +73,8 @@
|
|||
#include <assert.h>
|
||||
#define DUMP_DARWIN_CURSOR FALSE
|
||||
|
||||
#define CURSOR_PRIV(pScreen) \
|
||||
((XFIOKitCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
|
||||
#define CURSOR_PRIV(pScreen) ((XFIOKitCursorScreenPtr) \
|
||||
dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
|
||||
|
||||
// The cursors format are documented in IOFramebufferShared.h.
|
||||
#define RGBto34WithGamma(red, green, blue) \
|
||||
|
@ -99,8 +99,7 @@ typedef struct {
|
|||
ColormapPtr pInstalledMap;
|
||||
} XFIOKitCursorScreenRec, *XFIOKitCursorScreenPtr;
|
||||
|
||||
static int darwinCursorScreenIndex = -1;
|
||||
static unsigned long darwinCursorGeneration = 0;
|
||||
static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
|
||||
|
||||
/*
|
||||
===========================================================================
|
||||
|
@ -679,17 +678,10 @@ XFIOKitInitCursor(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// allocate private storage for this screen's hardware cursor info
|
||||
if (darwinCursorGeneration != serverGeneration) {
|
||||
if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
darwinCursorGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
ScreenPriv = xcalloc( 1, sizeof(XFIOKitCursorScreenRec) );
|
||||
if (!ScreenPriv) return FALSE;
|
||||
|
||||
pScreen->devPrivates[darwinCursorScreenIndex].ptr = (pointer) ScreenPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, darwinCursorScreenKey, ScreenPriv);
|
||||
|
||||
// check if a hardware cursor is supported
|
||||
if (!iokitScreen->cursorShmem->hardwareCursorCapable) {
|
||||
|
@ -722,7 +714,7 @@ XFIOKitInitCursor(
|
|||
|
||||
// initialize hardware cursor handling
|
||||
PointPriv = (miPointerScreenPtr)
|
||||
pScreen->devPrivates[miPointerScreenIndex].ptr;
|
||||
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
|
||||
|
||||
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
|
||||
PointPriv->spriteFuncs = &darwinSpriteFuncsRec;
|
||||
|
|
|
@ -49,18 +49,17 @@ typedef struct {
|
|||
} FSScreenRec, *FSScreenPtr;
|
||||
|
||||
#define FULLSCREEN_PRIV(pScreen) \
|
||||
((FSScreenPtr)pScreen->devPrivates[fsScreenIndex].ptr)
|
||||
((FSScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, fsScreenKey))
|
||||
|
||||
static int fsScreenIndex;
|
||||
static DevPrivateKey fsScreenKey = &fsScreenKey;
|
||||
static CGDirectDisplayID *quartzDisplayList = NULL;
|
||||
static int quartzNumScreens = 0;
|
||||
static FSScreenPtr quartzScreens[MAXSCREENS];
|
||||
|
||||
static int darwinCmapPrivateIndex = -1;
|
||||
static unsigned long darwinCmapGeneration = 0;
|
||||
static DevPrivateKey darwinCmapPrivateKey = &darwinCmapPrivateKey;
|
||||
|
||||
#define CMAP_PRIV(pCmap) \
|
||||
((CGDirectPaletteRef) (pCmap)->devPrivates[darwinCmapPrivateIndex].ptr)
|
||||
#define CMAP_PRIV(pCmap) ((CGDirectPaletteRef) \
|
||||
dixLookupPrivate(&(pCmap)->devPrivates, darwinCmapPrivateKey))
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
@ -95,16 +94,6 @@ FSCreateColormap(
|
|||
{
|
||||
CGDirectPaletteRef pallete;
|
||||
|
||||
// Allocate private storage for the hardware dependent colormap info.
|
||||
if (darwinCmapGeneration != serverGeneration) {
|
||||
if ((darwinCmapPrivateIndex =
|
||||
AllocateColormapPrivateIndex(FSInitCmapPrivates)) < 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
darwinCmapGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
pallete = CGPaletteCreateDefaultColorPalette();
|
||||
if (!pallete) return FALSE;
|
||||
|
||||
|
@ -283,17 +272,10 @@ static void FSResumeScreen(
|
|||
*/
|
||||
static void FSDisplayInit(void)
|
||||
{
|
||||
static unsigned long generation = 0;
|
||||
CGDisplayCount quartzDisplayCount = 0;
|
||||
|
||||
ErrorF("Display mode: Full screen Quartz -- Direct Display\n");
|
||||
|
||||
// Allocate private storage for each screen's mode specific info
|
||||
if (generation != serverGeneration) {
|
||||
fsScreenIndex = AllocateScreenPrivateIndex();
|
||||
generation = serverGeneration;
|
||||
}
|
||||
|
||||
// Find all the CoreGraphics displays
|
||||
CGGetActiveDisplayList(0, NULL, &quartzDisplayCount);
|
||||
quartzDisplayList = xalloc(quartzDisplayCount * sizeof(CGDirectDisplayID));
|
||||
|
|
|
@ -56,8 +56,7 @@ typedef struct {
|
|||
miPointerSpriteFuncPtr spriteFuncs;
|
||||
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
|
||||
|
||||
static int darwinCursorScreenIndex = -1;
|
||||
static unsigned long darwinCursorGeneration = 0;
|
||||
static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
|
||||
static CursorPtr quartzLatentCursor = NULL;
|
||||
static QD_Cursor gQDArrow; // QuickDraw arrow cursor
|
||||
|
||||
|
@ -66,8 +65,8 @@ static CCrsrHandle currentCursor = NULL;
|
|||
static pthread_mutex_t cursorMutex;
|
||||
static pthread_cond_t cursorCondition;
|
||||
|
||||
#define CURSOR_PRIV(pScreen) \
|
||||
((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
|
||||
#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, darwinCursorScreenKey))
|
||||
|
||||
#define HIDE_QD_CURSOR(pScreen, visible) \
|
||||
if (visible) { \
|
||||
|
@ -592,13 +591,6 @@ QuartzInitCursor(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// allocate private storage for this screen's QuickDraw cursor info
|
||||
if (darwinCursorGeneration != serverGeneration) {
|
||||
if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
darwinCursorGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
|
||||
if (!ScreenPriv) return FALSE;
|
||||
|
||||
|
@ -611,7 +603,7 @@ QuartzInitCursor(
|
|||
// initialize QuickDraw cursor handling
|
||||
GetQDGlobalsArrow(&gQDArrow);
|
||||
PointPriv = (miPointerScreenPtr)
|
||||
pScreen->devPrivates[miPointerScreenIndex].ptr;
|
||||
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
|
||||
|
||||
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
|
||||
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
|
||||
|
|
|
@ -62,7 +62,7 @@ int quartzUseAGL = 1;
|
|||
int quartzEnableKeyEquivalents = 1;
|
||||
int quartzServerVisible = TRUE;
|
||||
int quartzServerQuitting = FALSE;
|
||||
int quartzScreenIndex = 0;
|
||||
DevPrivateKey quartzScreenKey = &quartzScreenKey;
|
||||
int aquaMenuBarHeight = 0;
|
||||
int noPseudoramiXExtension = TRUE;
|
||||
QuartzModeProcsPtr quartzProcs = NULL;
|
||||
|
@ -121,14 +121,6 @@ void DarwinModeInitOutput(
|
|||
int argc,
|
||||
char **argv )
|
||||
{
|
||||
static unsigned long generation = 0;
|
||||
|
||||
// Allocate private storage for each screen's Quartz specific info
|
||||
if (generation != serverGeneration) {
|
||||
quartzScreenIndex = AllocateScreenPrivateIndex();
|
||||
generation = serverGeneration;
|
||||
}
|
||||
|
||||
if (serverGeneration == 0) {
|
||||
QuartzAudioInit();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ typedef struct {
|
|||
} QuartzScreenRec, *QuartzScreenPtr;
|
||||
|
||||
#define QUARTZ_PRIV(pScreen) \
|
||||
((QuartzScreenPtr)pScreen->devPrivates[quartzScreenIndex].ptr)
|
||||
((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey))
|
||||
|
||||
// Data stored at startup for Cocoa front end
|
||||
extern int quartzEventWriteFD;
|
||||
|
@ -73,7 +73,7 @@ extern int quartzEnableKeyEquivalents;
|
|||
// Other shared data
|
||||
extern int quartzServerVisible;
|
||||
extern int quartzServerQuitting;
|
||||
extern int quartzScreenIndex;
|
||||
extern DevPrivateKey quartzScreenKey;
|
||||
extern int aquaMenuBarHeight;
|
||||
|
||||
// Name of GLX bundle for native OpenGL
|
||||
|
|
|
@ -57,8 +57,7 @@ typedef struct {
|
|||
miPointerSpriteFuncPtr spriteFuncs;
|
||||
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
|
||||
|
||||
static int darwinCursorScreenIndex = -1;
|
||||
static unsigned long darwinCursorGeneration = 0;
|
||||
static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
|
||||
static CursorPtr quartzLatentCursor = NULL;
|
||||
static QD_Cursor gQDArrow; // QuickDraw arrow cursor
|
||||
|
||||
|
@ -67,8 +66,8 @@ static CCrsrHandle currentCursor = NULL;
|
|||
static pthread_mutex_t cursorMutex;
|
||||
static pthread_cond_t cursorCondition;
|
||||
|
||||
#define CURSOR_PRIV(pScreen) \
|
||||
((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
|
||||
#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
|
||||
dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
|
||||
|
||||
#define HIDE_QD_CURSOR(pScreen, visible) \
|
||||
if (visible) { \
|
||||
|
@ -595,13 +594,6 @@ QuartzInitCursor(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// allocate private storage for this screen's QuickDraw cursor info
|
||||
if (darwinCursorGeneration != serverGeneration) {
|
||||
if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
darwinCursorGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
|
||||
if (!ScreenPriv) return FALSE;
|
||||
|
||||
|
@ -614,7 +606,7 @@ QuartzInitCursor(
|
|||
// initialize QuickDraw cursor handling
|
||||
GetQDGlobalsArrow(&gQDArrow);
|
||||
PointPriv = (miPointerScreenPtr)
|
||||
pScreen->devPrivates[miPointerScreenIndex].ptr;
|
||||
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
|
||||
|
||||
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
|
||||
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
|
||||
|
|
|
@ -65,9 +65,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
static int DRIScreenPrivIndex = -1;
|
||||
static int DRIWindowPrivIndex = -1;
|
||||
static int DRIPixmapPrivIndex = -1;
|
||||
static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey;
|
||||
static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey;
|
||||
static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey;
|
||||
|
||||
static RESTYPE DRIDrawablePrivResType;
|
||||
|
||||
|
@ -179,11 +179,11 @@ DRIScreenInit(ScreenPtr pScreen)
|
|||
|
||||
pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
|
||||
if (!pDRIPriv) {
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv);
|
||||
pDRIPriv->directRenderingSupport = TRUE;
|
||||
pDRIPriv->nrWindows = 0;
|
||||
|
||||
|
@ -214,13 +214,6 @@ DRIFinishScreenInit(ScreenPtr pScreen)
|
|||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
/* Allocate zero sized private area for each window. Should a window
|
||||
* become a DRI window, we'll hang a DRIWindowPrivateRec off of this
|
||||
* private index.
|
||||
*/
|
||||
if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0))
|
||||
return FALSE;
|
||||
|
||||
/* Wrap DRI support */
|
||||
pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
|
||||
pScreen->ValidateTree = DRIValidateTree;
|
||||
|
@ -249,31 +242,13 @@ DRICloseScreen(ScreenPtr pScreen)
|
|||
|
||||
if (pDRIPriv && pDRIPriv->directRenderingSupport) {
|
||||
xfree(pDRIPriv);
|
||||
pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL;
|
||||
dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
DRIExtensionInit(void)
|
||||
{
|
||||
static unsigned long DRIGeneration = 0;
|
||||
|
||||
if (DRIGeneration != serverGeneration) {
|
||||
if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
DRIGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a window private index with a zero sized private area for
|
||||
* each window, then should a window become a DRI window, we'll hang
|
||||
* a DRIWindowPrivateRec off of this private index. Do same for pixmaps.
|
||||
*/
|
||||
if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
|
||||
DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete);
|
||||
|
||||
return TRUE;
|
||||
|
@ -417,7 +392,8 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
|
|||
}
|
||||
|
||||
/* save private off of preallocated index */
|
||||
pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv;
|
||||
dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey,
|
||||
pDRIDrawablePriv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,7 +426,8 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
|
|||
}
|
||||
|
||||
/* save private off of preallocated index */
|
||||
pPix->devPrivates[DRIPixmapPrivIndex].ptr = (pointer)pDRIDrawablePriv;
|
||||
dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey,
|
||||
pDRIDrawablePriv);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -577,9 +554,9 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
|
|||
xfree(pDRIDrawablePriv);
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
|
||||
dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
|
||||
} else if (pDrawable->type == DRAWABLE_PIXMAP) {
|
||||
pPix->devPrivates[DRIPixmapPrivIndex].ptr = NULL;
|
||||
dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL);
|
||||
}
|
||||
|
||||
--pDRIPriv->nrWindows;
|
||||
|
|
|
@ -40,15 +40,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#define DRI_MAX_DRAWABLES 256
|
||||
|
||||
#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \
|
||||
((DRIWindowPrivIndex < 0) ? \
|
||||
NULL : \
|
||||
((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr)))
|
||||
#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
|
||||
dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
|
||||
|
||||
#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \
|
||||
((DRIPixmapPrivIndex < 0) ? \
|
||||
NULL : \
|
||||
((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIPixmapPrivIndex].ptr)))
|
||||
#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
|
||||
dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey))
|
||||
|
||||
typedef struct _DRIDrawablePrivRec
|
||||
{
|
||||
|
@ -61,13 +57,12 @@ typedef struct _DRIDrawablePrivRec
|
|||
x_list *notifiers; /* list of (FUN . DATA) */
|
||||
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
|
||||
|
||||
#define DRI_SCREEN_PRIV(pScreen) \
|
||||
((DRIScreenPrivIndex < 0) ? \
|
||||
NULL : \
|
||||
((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr)))
|
||||
#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey))
|
||||
|
||||
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
|
||||
(screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr))
|
||||
dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
|
||||
DRIScreenPrivKey))
|
||||
|
||||
|
||||
typedef struct _DRIScreenPrivRec
|
||||
|
|
|
@ -53,11 +53,10 @@ typedef struct {
|
|||
miPointerSpriteFuncPtr spriteFuncs;
|
||||
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
|
||||
|
||||
static int darwinCursorScreenIndex = -1;
|
||||
static unsigned long darwinCursorGeneration = 0;
|
||||
static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
|
||||
|
||||
#define CURSOR_PRIV(pScreen) \
|
||||
((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr)
|
||||
#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
|
||||
dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
|
||||
|
||||
|
||||
static Bool
|
||||
|
@ -360,15 +359,6 @@ QuartzInitCursor(ScreenPtr pScreen)
|
|||
if (!miDCInitialize(pScreen, &quartzScreenFuncsRec))
|
||||
return FALSE;
|
||||
|
||||
/* allocate private storage for this screen's QuickDraw cursor info */
|
||||
if (darwinCursorGeneration != serverGeneration)
|
||||
{
|
||||
if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
|
||||
darwinCursorGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
ScreenPriv = xcalloc(1, sizeof(QuartzCursorScreenRec));
|
||||
if (ScreenPriv == NULL)
|
||||
return FALSE;
|
||||
|
@ -379,7 +369,8 @@ QuartzInitCursor(ScreenPtr pScreen)
|
|||
ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
|
||||
pScreen->QueryBestSize = QuartzCursorQueryBestSize;
|
||||
|
||||
PointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr;
|
||||
PointPriv = (miPointerScreenPtr)
|
||||
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
|
||||
|
||||
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
|
||||
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
|
||||
|
|
|
@ -46,24 +46,10 @@
|
|||
|
||||
#include "micmap.h"
|
||||
|
||||
static int dmxInitColormapPrivateFunc(ColormapPtr pColormap, int index)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
|
||||
{
|
||||
static unsigned long dmxColormapGeneration;
|
||||
dmxColormapPrivPtr pCmapPriv;
|
||||
|
||||
if (dmxColormapGeneration != serverGeneration) {
|
||||
if ((dmxColormapPrivateIndex
|
||||
= AllocateColormapPrivateIndex(dmxInitColormapPrivateFunc)) < 0)
|
||||
return FALSE;
|
||||
|
||||
dmxColormapGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv));
|
||||
if (!pCmapPriv)
|
||||
return FALSE;
|
||||
|
|
|
@ -56,15 +56,14 @@ extern Bool dmxBECreateColormap(ColormapPtr pColormap);
|
|||
extern Bool dmxBEFreeColormap(ColormapPtr pColormap);
|
||||
|
||||
/** Private index. \see dmxcmap.c \see dmxscrinit.c \see dmxwindow.c */
|
||||
extern int dmxColormapPrivateIndex;
|
||||
extern DevPrivateKey dmxColormapPrivateKey;
|
||||
|
||||
/** Set colormap private structure. */
|
||||
#define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \
|
||||
(_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr \
|
||||
= (pointer)(_pCMapPriv);
|
||||
dixSetPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey, _pCMapPriv)
|
||||
|
||||
/** Get colormap private structure. */
|
||||
#define DMX_GET_COLORMAP_PRIV(_pCMap) \
|
||||
(dmxColormapPrivPtr)(_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr
|
||||
#define DMX_GET_COLORMAP_PRIV(_pCMap) (dmxColormapPrivPtr) \
|
||||
dixLookupPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey)
|
||||
|
||||
#endif /* DMXCMAP_H */
|
||||
|
|
|
@ -177,7 +177,7 @@ void dmxDPMSWakeup(void)
|
|||
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||
SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||
#ifdef DPMSExtension
|
||||
if (DPMSPowerLevel) DPMSSet(0);
|
||||
if (DPMSPowerLevel) DPMSSet(serverClient, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -190,11 +190,11 @@ Bool DPMSSupported(void)
|
|||
}
|
||||
|
||||
/** This is used by clients (e.g., xset) to set the DPMS level. */
|
||||
void DPMSSet(int level)
|
||||
int DPMSSet(ClientPtr client, int level)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!dpmsSupported) return;
|
||||
if (!dpmsSupported) return Success;
|
||||
|
||||
if (level < 0) level = DPMSModeOn;
|
||||
if (level > 3) level = DPMSModeOff;
|
||||
|
@ -208,5 +208,6 @@ void DPMSSet(int level)
|
|||
dmxSync(dmxScreen, FALSE);
|
||||
}
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -82,13 +82,9 @@ static GCOps dmxGCOps = {
|
|||
dmxPushPixels
|
||||
};
|
||||
|
||||
/** Initialize the GC on \a pScreen, which currently involves allocating
|
||||
* the GC private associated with this screen. */
|
||||
/** Initialize the GC on \a pScreen */
|
||||
Bool dmxInitGC(ScreenPtr pScreen)
|
||||
{
|
||||
if (!AllocateGCPrivate(pScreen, dmxGCPrivateIndex, sizeof(dmxGCPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,11 +64,11 @@ extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
|
|||
extern Bool dmxBEFreeGC(GCPtr pGC);
|
||||
|
||||
/** Private index. \see dmxgc.c \see dmxscrinit.c */
|
||||
extern int dmxGCPrivateIndex;
|
||||
extern DevPrivateKey dmxGCPrivateKey;
|
||||
|
||||
/** Get private. */
|
||||
#define DMX_GET_GC_PRIV(_pGC) \
|
||||
(dmxGCPrivPtr)(_pGC)->devPrivates[dmxGCPrivateIndex].ptr
|
||||
(dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey)
|
||||
|
||||
#define DMX_GC_FUNC_PROLOGUE(_pGC) \
|
||||
do { \
|
||||
|
|
|
@ -144,8 +144,7 @@ Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
|||
if (!miPictureInit(pScreen, formats, nformats))
|
||||
return FALSE;
|
||||
|
||||
if (!AllocatePicturePrivate(pScreen, dmxPictPrivateIndex,
|
||||
sizeof(dmxPictPrivRec)))
|
||||
if (!dixRequestPrivate(dmxPictPrivateKey, sizeof(dmxPictPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
ps = GetPictureScreen(pScreen);
|
||||
|
|
|
@ -116,19 +116,19 @@ extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
|
|||
extern int dmxBECreatePicture(PicturePtr pPicture);
|
||||
extern Bool dmxBEFreePicture(PicturePtr pPicture);
|
||||
|
||||
extern int dmxPictPrivateIndex; /**< Index for picture private data */
|
||||
extern int dmxGlyphSetPrivateIndex; /**< Index for glyphset private data */
|
||||
extern DevPrivateKey dmxPictPrivateKey; /**< Index for picture private data */
|
||||
extern DevPrivateKey dmxGlyphSetPrivateKey; /**< Index for glyphset private data */
|
||||
|
||||
|
||||
/** Get the picture private data given a picture pointer */
|
||||
#define DMX_GET_PICT_PRIV(_pPict) \
|
||||
(dmxPictPrivPtr)(_pPict)->devPrivates[dmxPictPrivateIndex].ptr
|
||||
(dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
|
||||
|
||||
/** Set the glyphset private data given a glyphset pointer */
|
||||
#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
|
||||
GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateIndex, (_pPriv))
|
||||
GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
|
||||
/** Get the glyphset private data given a glyphset pointer */
|
||||
#define DMX_GET_GLYPH_PRIV(_pGlyph) \
|
||||
(dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateIndex)
|
||||
(dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
|
||||
|
||||
#endif /* DMXPICT_H */
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
/** Initialize a private area in \a pScreen for pixmap information. */
|
||||
Bool dmxInitPixmap(ScreenPtr pScreen)
|
||||
{
|
||||
if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex,
|
||||
sizeof(dmxPixPrivRec)))
|
||||
if (!dixRequestPrivate(dmxPixPrivateKey, sizeof(dmxPixPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
@ -173,7 +172,7 @@ Bool dmxDestroyPixmap(PixmapPtr pPixmap)
|
|||
dmxSync(dmxScreen, FALSE);
|
||||
}
|
||||
}
|
||||
dixFreePrivates(*DEVPRIV_PTR(pPixmap));
|
||||
dixFreePrivates(pPixmap->devPrivates);
|
||||
xfree(pPixmap);
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -57,10 +57,10 @@ extern void dmxBECreatePixmap(PixmapPtr pPixmap);
|
|||
extern Bool dmxBEFreePixmap(PixmapPtr pPixmap);
|
||||
|
||||
/** Private index. \see dmxpicmap.h \see dmxscrinit.c */
|
||||
extern int dmxPixPrivateIndex;
|
||||
extern DevPrivateKey dmxPixPrivateKey;
|
||||
|
||||
/** Get pixmap private pointer. */
|
||||
#define DMX_GET_PIXMAP_PRIV(_pPix) \
|
||||
(dmxPixPrivPtr)(_pPix)->devPrivates[dmxPixPrivateIndex].ptr
|
||||
(dmxPixPrivPtr)dixLookupPrivate(&(_pPix)->devPrivates, dmxPixPrivateKey)
|
||||
|
||||
#endif /* DMXPIXMAP_H */
|
||||
|
|
|
@ -67,15 +67,15 @@ static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
|
|||
static unsigned long dmxGeneration;
|
||||
static unsigned long *dmxCursorGeneration;
|
||||
|
||||
int dmxGCPrivateIndex; /**< Private index for GCs */
|
||||
int dmxWinPrivateIndex; /**< Private index for Windows */
|
||||
int dmxPixPrivateIndex; /**< Private index for Pixmaps */
|
||||
DevPrivateKey dmxGCPrivateKey = &dmxGCPrivateKey; /**< Private index for GCs */
|
||||
DevPrivateKey dmxWinPrivateKey = &dmxWinPrivateKey; /**< Private index for Windows */
|
||||
DevPrivateKey dmxPixPrivateKey = &dmxPixPrivateKey; /**< Private index for Pixmaps */
|
||||
int dmxFontPrivateIndex; /**< Private index for Fonts */
|
||||
int dmxScreenPrivateIndex; /**< Private index for Screens */
|
||||
int dmxColormapPrivateIndex; /**< Private index for Colormaps */
|
||||
DevPrivateKey dmxScreenPrivateKey = &dmxScreenPrivateKey; /**< Private index for Screens */
|
||||
DevPrivateKey dmxColormapPrivateKey = &dmxColormapPrivateKey; /**< Private index for Colormaps */
|
||||
#ifdef RENDER
|
||||
int dmxPictPrivateIndex; /**< Private index for Picts */
|
||||
int dmxGlyphSetPrivateIndex; /**< Private index for GlyphSets */
|
||||
DevPrivateKey dmxPictPrivateKey = &dmxPictPrivateKey; /**< Private index for Picts */
|
||||
DevPrivateKey dmxGlyphSetPrivateKey = &dmxGlyphSetPrivateKey; /**< Private index for GlyphSets */
|
||||
#endif
|
||||
|
||||
/** Initialize the parts of screen \a idx that require access to the
|
||||
|
@ -208,43 +208,11 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
|
|||
int i, j;
|
||||
|
||||
if (dmxGeneration != serverGeneration) {
|
||||
#ifdef RENDER
|
||||
/* Allocate picture private index */
|
||||
dmxPictPrivateIndex = AllocatePicturePrivateIndex();
|
||||
if (dmxPictPrivateIndex == -1)
|
||||
return FALSE;
|
||||
|
||||
/* Allocate glyph set private index */
|
||||
dmxGlyphSetPrivateIndex = AllocateGlyphSetPrivateIndex();
|
||||
if (dmxGlyphSetPrivateIndex == -1)
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
/* Allocate GC private index */
|
||||
dmxGCPrivateIndex = AllocateGCPrivateIndex();
|
||||
if (dmxGCPrivateIndex == -1)
|
||||
return FALSE;
|
||||
|
||||
/* Allocate window private index */
|
||||
dmxWinPrivateIndex = AllocateWindowPrivateIndex();
|
||||
if (dmxWinPrivateIndex == -1)
|
||||
return FALSE;
|
||||
|
||||
/* Allocate pixmap private index */
|
||||
dmxPixPrivateIndex = AllocatePixmapPrivateIndex();
|
||||
if (dmxPixPrivateIndex == -1)
|
||||
return FALSE;
|
||||
|
||||
/* Allocate font private index */
|
||||
dmxFontPrivateIndex = AllocateFontPrivateIndex();
|
||||
if (dmxFontPrivateIndex == -1)
|
||||
return FALSE;
|
||||
|
||||
/* Allocate screen private index */
|
||||
dmxScreenPrivateIndex = AllocateScreenPrivateIndex();
|
||||
if (dmxScreenPrivateIndex == -1)
|
||||
return FALSE;
|
||||
|
||||
dmxGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "scrnintstr.h"
|
||||
|
||||
/** Private index. \see dmxscrrinit.c \see input/dmxconcole.c */
|
||||
extern int dmxScreenPrivateIndex;
|
||||
extern DevPrivateKey dmxScreenPrivateKey;
|
||||
|
||||
extern Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]);
|
||||
|
||||
|
|
|
@ -64,8 +64,7 @@ static void dmxDoSetShape(WindowPtr pWindow);
|
|||
/** Initialize the private area for the window functions. */
|
||||
Bool dmxInitWindow(ScreenPtr pScreen)
|
||||
{
|
||||
if (!AllocateWindowPrivate(pScreen, dmxWinPrivateIndex,
|
||||
sizeof(dmxWinPrivRec)))
|
||||
if (!dixRequestPrivate(dmxWinPrivateKey, sizeof(dmxWinPrivRec)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -107,11 +107,11 @@ extern void dmxSetShape(WindowPtr pWindow);
|
|||
#endif
|
||||
|
||||
/** Private index. \see dmxwindow.c \see dmxscrinit.c */
|
||||
extern int dmxWinPrivateIndex;
|
||||
extern DevPrivateKey dmxWinPrivateKey;
|
||||
|
||||
/** Get window private pointer. */
|
||||
#define DMX_GET_WINDOW_PRIV(_pWin) \
|
||||
((dmxWinPrivPtr)(_pWin)->devPrivates[dmxWinPrivateIndex].ptr)
|
||||
#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
|
||||
dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
|
||||
|
||||
/* All of these macros are only used in dmxwindow.c */
|
||||
#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
|
||||
|
|
|
@ -612,7 +612,8 @@ static Bool dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
|
|||
{
|
||||
myPrivate *priv, *last;
|
||||
|
||||
for (last = priv = pScreen->devPrivates[dmxScreenPrivateIndex].ptr;
|
||||
for (last = priv = (myPrivate *)dixLookupPrivate(&pScreen->devPrivates,
|
||||
dmxScreenPrivateKey);
|
||||
priv;
|
||||
priv = priv->next) dmxCloseConsole(last = priv);
|
||||
|
||||
|
@ -846,13 +847,15 @@ void dmxConsoleInit(DevicePtr pDev)
|
|||
|
||||
dmxConsoleDraw(priv, 1, 1);
|
||||
|
||||
if (screenInfo.screens[0]->devPrivates[dmxScreenPrivateIndex].ptr)
|
||||
priv->next = (screenInfo.screens[0]
|
||||
->devPrivates[dmxScreenPrivateIndex].ptr);
|
||||
if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
|
||||
dmxScreenPrivateKey))
|
||||
priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
|
||||
dmxScreenPrivateKey);
|
||||
else
|
||||
DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
|
||||
priv, screenInfo.screens[0]);
|
||||
screenInfo.screens[0]->devPrivates[dmxScreenPrivateIndex].ptr = priv;
|
||||
dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
|
||||
priv);
|
||||
}
|
||||
|
||||
/** Fill in the \a info structure for the specified \a pDev. Only used
|
||||
|
|
|
@ -78,9 +78,8 @@ short s3alu[16] = {
|
|||
#define PixTransStore(t) *pix_trans = (t)
|
||||
#endif
|
||||
|
||||
int s3GCPrivateIndex;
|
||||
int s3WindowPrivateIndex;
|
||||
int s3Generation;
|
||||
DevPrivateKey s3GCPrivateKey = &s3GCPrivateKey;
|
||||
DevPrivateKey s3WindowPrivateKey = &s3WindowPrivateKey;
|
||||
|
||||
/*
|
||||
s3DoBitBlt
|
||||
|
@ -2182,7 +2181,7 @@ s3CreateWindow (WindowPtr pWin)
|
|||
KdScreenPriv(pWin->drawable.pScreen);
|
||||
s3ScreenInfo(pScreenPriv);
|
||||
|
||||
pWin->devPrivates[s3WindowPrivateIndex].ptr = 0;
|
||||
dixSetPrivate(&pWin->devPrivates, s3WindowPrivateKey, NULL);
|
||||
return KdCreateWindow (pWin);
|
||||
}
|
||||
|
||||
|
@ -3095,15 +3094,7 @@ s3DrawInit (ScreenPtr pScreen)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (serverGeneration != s3Generation)
|
||||
{
|
||||
s3GCPrivateIndex = AllocateGCPrivateIndex ();
|
||||
s3WindowPrivateIndex = AllocateWindowPrivateIndex ();
|
||||
s3Generation = serverGeneration;
|
||||
}
|
||||
if (!AllocateWindowPrivate(pScreen, s3WindowPrivateIndex, 0))
|
||||
return FALSE;
|
||||
if (!AllocateGCPrivate(pScreen, s3GCPrivateIndex, sizeof (s3PrivGCRec)))
|
||||
if (!dixRequestPrivate(s3GCPrivateKey, sizeof (s3PrivGCRec)))
|
||||
return FALSE;
|
||||
pScreen->CreateGC = s3CreateGC;
|
||||
pScreen->CreateWindow = s3CreateWindow;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#ifndef _S3DRAW_H_
|
||||
#define _S3DRAW_H_
|
||||
|
||||
extern int s3GCPrivateIndex;
|
||||
extern int s3WindowPrivateIndex;
|
||||
extern DevPrivateKey s3GCPrivateKey;
|
||||
extern DevPrivateKey s3WindowPrivateKey;
|
||||
|
||||
typedef struct _s3Pattern {
|
||||
S3PatternCache *cache;
|
||||
|
@ -42,16 +42,16 @@ typedef struct _s3PrivGC {
|
|||
s3PatternPtr pPattern; /* pattern */
|
||||
} s3PrivGCRec, *s3PrivGCPtr;
|
||||
|
||||
#define s3GetGCPrivate(g) ((s3PrivGCPtr) \
|
||||
(g)->devPrivates[s3GCPrivateIndex].ptr)
|
||||
#define s3GetGCPrivate(g) ((s3PrivGCPtr) \
|
||||
dixLookupPrivate(&(g)->devPrivates, s3GCPrivateKey))
|
||||
|
||||
#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g)
|
||||
#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g)
|
||||
|
||||
#define s3GetWindowPrivate(w) ((s3PatternPtr) \
|
||||
(w)->devPrivates[s3WindowPrivateIndex].ptr)
|
||||
#define s3GetWindowPrivate(w) ((s3PatternPtr) \
|
||||
dixLookupPrivate(&(w)->devPrivates, s3WindowPrivateKey))
|
||||
|
||||
#define s3SetWindowPrivate(w,p) (\
|
||||
(w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p)
|
||||
#define s3SetWindowPrivate(w,p) \
|
||||
dixSetPrivate(&(w)->devPrivates, s3WindowPrivateKey, p)
|
||||
|
||||
void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern);
|
||||
|
||||
|
|
|
@ -42,9 +42,8 @@
|
|||
#define DBG_PIXMAP(a)
|
||||
#endif
|
||||
|
||||
int kaaGeneration;
|
||||
int kaaScreenPrivateIndex;
|
||||
int kaaPixmapPrivateIndex;
|
||||
DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey;
|
||||
DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey;
|
||||
|
||||
#define KAA_PIXMAP_SCORE_MOVE_IN 10
|
||||
#define KAA_PIXMAP_SCORE_MAX 20
|
||||
|
@ -1066,13 +1065,6 @@ kaaDrawInit (ScreenPtr pScreen,
|
|||
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
|
||||
#endif
|
||||
|
||||
if (kaaGeneration != serverGeneration)
|
||||
{
|
||||
kaaScreenPrivateIndex = AllocateScreenPrivateIndex();
|
||||
kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex();
|
||||
kaaGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
|
||||
|
||||
if (!pKaaScr)
|
||||
|
@ -1080,7 +1072,7 @@ kaaDrawInit (ScreenPtr pScreen,
|
|||
|
||||
pKaaScr->info = pScreenInfo;
|
||||
|
||||
pScreen->devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr;
|
||||
dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr);
|
||||
|
||||
/*
|
||||
* Hook up asynchronous drawing
|
||||
|
@ -1106,17 +1098,11 @@ kaaDrawInit (ScreenPtr pScreen,
|
|||
if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
|
||||
screen->off_screen_base < screen->memory_size)
|
||||
{
|
||||
if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex,
|
||||
sizeof (KaaPixmapPrivRec)))
|
||||
if (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec)))
|
||||
return FALSE;
|
||||
pScreen->CreatePixmap = kaaCreatePixmap;
|
||||
pScreen->DestroyPixmap = kaaDestroyPixmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,14 @@
|
|||
|
||||
#include "picturestr.h"
|
||||
|
||||
#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr)
|
||||
#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \
|
||||
dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey))
|
||||
#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
|
||||
|
||||
#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr)
|
||||
#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a))
|
||||
#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \
|
||||
dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey))
|
||||
#define KaaSetPixmapPriv(p,a) \
|
||||
dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a)
|
||||
#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
|
||||
|
||||
typedef struct {
|
||||
|
@ -46,8 +49,8 @@ typedef struct {
|
|||
Bool dirty;
|
||||
} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
|
||||
|
||||
extern int kaaScreenPrivateIndex;
|
||||
extern int kaaPixmapPrivateIndex;
|
||||
extern DevPrivateKey kaaScreenPrivateKey;
|
||||
extern DevPrivateKey kaaPixmapPrivateKey;
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -498,7 +498,7 @@ typedef struct _KaaScreenInfo {
|
|||
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
|
||||
#endif
|
||||
|
||||
extern int kdScreenPrivateIndex;
|
||||
extern DevPrivateKey kdScreenPrivateKey;
|
||||
extern unsigned long kdGeneration;
|
||||
extern Bool kdEnabled;
|
||||
extern Bool kdSwitchPending;
|
||||
|
@ -510,9 +510,9 @@ extern char *kdSwitchCmd;
|
|||
extern KdOsFuncs *kdOsFuncs;
|
||||
|
||||
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
|
||||
(pScreen)->devPrivates[kdScreenPrivateIndex].ptr)
|
||||
#define KdSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[kdScreenPrivateIndex].ptr = \
|
||||
(pointer) v)
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
|
||||
#define KdSetScreenPriv(pScreen,v) \
|
||||
dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
|
||||
#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
|
||||
|
||||
/* kaa.c */
|
||||
|
|
|
@ -104,23 +104,22 @@ static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
|
|||
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int);
|
||||
|
||||
|
||||
int KdXVWindowIndex = -1;
|
||||
int KdXvScreenIndex = -1;
|
||||
static unsigned long KdXVGeneration = 0;
|
||||
DevPrivateKey KdXVWindowKey = &KdXVWindowKey;
|
||||
DevPrivateKey KdXvScreenKey = &KdXvScreenKey;
|
||||
static unsigned long PortResource = 0;
|
||||
|
||||
int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex;
|
||||
int (*XvGetScreenKeyProc)(void) = XvGetScreenKey;
|
||||
unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
|
||||
int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
|
||||
|
||||
#define GET_XV_SCREEN(pScreen) \
|
||||
((XvScreenPtr)((pScreen)->devPrivates[KdXvScreenIndex].ptr))
|
||||
#define GET_XV_SCREEN(pScreen) ((XvScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey))
|
||||
|
||||
#define GET_KDXV_SCREEN(pScreen) \
|
||||
((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
|
||||
|
||||
#define GET_KDXV_WINDOW(pWin) \
|
||||
((KdXVWindowPtr)((pWin)->devPrivates[KdXVWindowIndex].ptr))
|
||||
#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
|
||||
dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
|
||||
|
||||
static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
|
||||
static int NumGenDrivers = 0;
|
||||
|
@ -192,21 +191,12 @@ KdXVScreenInit(
|
|||
|
||||
/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
|
||||
|
||||
if(KdXVGeneration != serverGeneration) {
|
||||
if((KdXVWindowIndex = AllocateWindowPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
KdXVGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
if(!AllocateWindowPrivate(pScreen,KdXVWindowIndex,0))
|
||||
return FALSE;
|
||||
|
||||
if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc)
|
||||
if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
|
||||
return FALSE;
|
||||
|
||||
if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
|
||||
|
||||
KdXvScreenIndex = (*XvGetScreenIndexProc)();
|
||||
KdXvScreenIndex = (*XvGetScreenKeyProc)();
|
||||
PortResource = (*XvGetRTPortProc)();
|
||||
|
||||
pxvs = GET_XV_SCREEN(pScreen);
|
||||
|
@ -938,7 +928,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
|
|||
if(!winPriv) return BadAlloc;
|
||||
winPriv->PortRec = portPriv;
|
||||
winPriv->next = PrivRoot;
|
||||
pWin->devPrivates[KdXVWindowIndex].ptr = (pointer)winPriv;
|
||||
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
@ -956,8 +946,7 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
|
|||
if(prevPriv)
|
||||
prevPriv->next = winPriv->next;
|
||||
else
|
||||
pWin->devPrivates[KdXVWindowIndex].ptr =
|
||||
(pointer)winPriv->next;
|
||||
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
|
||||
xfree(winPriv);
|
||||
break;
|
||||
}
|
||||
|
@ -981,7 +970,8 @@ KdXVCreateWindow(WindowPtr pWin)
|
|||
ret = (*pScreen->CreateWindow)(pWin);
|
||||
pScreen->CreateWindow = KdXVCreateWindow;
|
||||
|
||||
if(ret) pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
|
||||
if (ret)
|
||||
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1010,7 +1000,7 @@ KdXVDestroyWindow(WindowPtr pWin)
|
|||
xfree(tmp);
|
||||
}
|
||||
|
||||
pWin->devPrivates[KdXVWindowIndex].ptr = NULL;
|
||||
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
|
||||
|
||||
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
|
||||
ret = (*pScreen->DestroyWindow)(pWin);
|
||||
|
@ -1067,8 +1057,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
|
|||
pPriv->pDraw = NULL;
|
||||
|
||||
if(!pPrev)
|
||||
pWin->devPrivates[KdXVWindowIndex].ptr =
|
||||
(pointer)(WinPriv->next);
|
||||
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
|
||||
else
|
||||
pPrev->next = WinPriv->next;
|
||||
tmp = WinPriv;
|
||||
|
@ -1117,8 +1106,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
|
|||
pPriv->pDraw = NULL;
|
||||
|
||||
if(!pPrev)
|
||||
pWin->devPrivates[KdXVWindowIndex].ptr =
|
||||
(pointer)(WinPriv->next);
|
||||
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
|
||||
else
|
||||
pPrev->next = WinPriv->next;
|
||||
tmp = WinPriv;
|
||||
|
|
|
@ -57,9 +57,9 @@
|
|||
/* General parameters */
|
||||
extern int xf86DoConfigure;
|
||||
extern Bool xf86DoConfigurePass1;
|
||||
extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */
|
||||
extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */
|
||||
extern int xf86PixmapIndex;
|
||||
extern DevPrivateKey xf86ScreenKey;
|
||||
extern DevPrivateKey xf86CreateRootWindowKey;
|
||||
extern DevPrivateKey xf86PixmapKey;
|
||||
extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
|
||||
extern const unsigned char byte_reversed[256];
|
||||
extern ScrnInfoPtr xf86CurrentScreen;
|
||||
|
@ -72,8 +72,8 @@ extern Bool sbusSlotClaimed;
|
|||
extern confDRIRec xf86ConfigDRI;
|
||||
extern Bool xf86inSuspend;
|
||||
|
||||
#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr))
|
||||
|
||||
#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
|
||||
xf86ScreenKey))
|
||||
#define XF86FLIP_PIXELS() \
|
||||
do { \
|
||||
if (xf86GetFlipPixels()) { \
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
|
||||
#include "mi.h"
|
||||
|
||||
static unsigned long DGAGeneration = 0;
|
||||
static int DGAScreenIndex = -1;
|
||||
static DevPrivateKey DGAScreenKey = NULL;
|
||||
static int mieq_installed = 0;
|
||||
|
||||
static Bool DGACloseScreen(int i, ScreenPtr pScreen);
|
||||
|
@ -68,8 +67,8 @@ DGACopyModeInfo(
|
|||
|
||||
_X_EXPORT int *XDGAEventBase = NULL;
|
||||
|
||||
#define DGA_GET_SCREEN_PRIV(pScreen) \
|
||||
((DGAScreenPtr)((pScreen)->devPrivates[DGAScreenIndex].ptr))
|
||||
#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, DGAScreenKey))
|
||||
|
||||
|
||||
typedef struct _FakedVisualList{
|
||||
|
@ -116,11 +115,7 @@ DGAInit(
|
|||
if(!modes || num <= 0)
|
||||
return FALSE;
|
||||
|
||||
if(DGAGeneration != serverGeneration) {
|
||||
if((DGAScreenIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
DGAGeneration = serverGeneration;
|
||||
}
|
||||
DGAScreenKey = &DGAScreenKey;
|
||||
|
||||
if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
|
||||
return FALSE;
|
||||
|
@ -148,7 +143,7 @@ DGAInit(
|
|||
modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
|
||||
#endif
|
||||
|
||||
pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv;
|
||||
dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
|
||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
pScreen->CloseScreen = DGACloseScreen;
|
||||
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
|
||||
|
@ -176,7 +171,7 @@ DGAReInitModes(
|
|||
int i;
|
||||
|
||||
/* No DGA? Ignore call (but don't make it look like it failed) */
|
||||
if(DGAScreenIndex < 0)
|
||||
if(DGAScreenKey == NULL)
|
||||
return TRUE;
|
||||
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
||||
|
@ -350,7 +345,7 @@ xf86SetDGAMode(
|
|||
DGAModePtr pMode = NULL;
|
||||
|
||||
/* First check if DGAInit was successful on this screen */
|
||||
if (DGAScreenIndex < 0)
|
||||
if (DGAScreenKey == NULL)
|
||||
return BadValue;
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
||||
if (!pScreenPriv)
|
||||
|
@ -485,7 +480,7 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
|
|||
DGAModePtr pMode;
|
||||
PixmapPtr pPix;
|
||||
|
||||
if(DGAScreenIndex < 0)
|
||||
if(DGAScreenKey == NULL)
|
||||
return FALSE;
|
||||
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
|
||||
|
@ -535,11 +530,12 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode)
|
|||
_X_EXPORT Bool
|
||||
DGAAvailable(int index)
|
||||
{
|
||||
if(DGAScreenIndex < 0)
|
||||
if(DGAScreenKey == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!xf86NoSharedResources(((ScrnInfoPtr)screenInfo.screens[index]->
|
||||
devPrivates[xf86ScreenIndex].ptr)->scrnIndex,MEM))
|
||||
if (!xf86NoSharedResources(((ScrnInfoPtr)dixLookupPrivate(
|
||||
&screenInfo.screens[index]->devPrivates,
|
||||
xf86ScreenKey))->scrnIndex, MEM))
|
||||
return FALSE;
|
||||
|
||||
if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index]))
|
||||
|
@ -553,7 +549,7 @@ DGAActive(int index)
|
|||
{
|
||||
DGAScreenPtr pScreenPriv;
|
||||
|
||||
if(DGAScreenIndex < 0)
|
||||
if(DGAScreenKey == NULL)
|
||||
return FALSE;
|
||||
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
|
||||
|
@ -574,7 +570,7 @@ DGAShutdown()
|
|||
ScrnInfoPtr pScrn;
|
||||
int i;
|
||||
|
||||
if(DGAScreenIndex < 0)
|
||||
if(DGAScreenKey == NULL)
|
||||
return;
|
||||
|
||||
for(i = 0; i < screenInfo.numScreens; i++) {
|
||||
|
@ -904,7 +900,7 @@ DGAVTSwitch(void)
|
|||
|
||||
/* Alternatively, this could send events to DGA clients */
|
||||
|
||||
if(DGAScreenIndex >= 0) {
|
||||
if(DGAScreenKey) {
|
||||
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
||||
|
||||
if(pScreenPriv && pScreenPriv->current)
|
||||
|
@ -921,7 +917,7 @@ DGAStealKeyEvent(int index, int key_code, int is_down)
|
|||
DGAScreenPtr pScreenPriv;
|
||||
dgaEvent de;
|
||||
|
||||
if(DGAScreenIndex < 0) /* no DGA */
|
||||
if(DGAScreenKey == NULL) /* no DGA */
|
||||
return FALSE;
|
||||
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
|
||||
|
@ -945,7 +941,7 @@ DGAStealMotionEvent(int index, int dx, int dy)
|
|||
DGAScreenPtr pScreenPriv;
|
||||
dgaEvent de;
|
||||
|
||||
if(DGAScreenIndex < 0) /* no DGA */
|
||||
if(DGAScreenKey == NULL) /* no DGA */
|
||||
return FALSE;
|
||||
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
|
||||
|
@ -980,7 +976,7 @@ DGAStealButtonEvent(int index, int button, int is_down)
|
|||
DGAScreenPtr pScreenPriv;
|
||||
dgaEvent de;
|
||||
|
||||
if (DGAScreenIndex < 0)
|
||||
if (DGAScreenKey == NULL)
|
||||
return FALSE;
|
||||
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
|
||||
|
@ -1006,7 +1002,7 @@ Bool
|
|||
DGAIsDgaEvent (xEvent *e)
|
||||
{
|
||||
int coreEquiv;
|
||||
if (DGAScreenIndex < 0 || XDGAEventBase == 0)
|
||||
if (DGAScreenKey == NULL || XDGAEventBase == 0)
|
||||
return FALSE;
|
||||
coreEquiv = e->u.u.type - *XDGAEventBase;
|
||||
if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify)
|
||||
|
@ -1275,7 +1271,7 @@ DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents)
|
|||
int coreEquiv;
|
||||
|
||||
/* no DGA */
|
||||
if (DGAScreenIndex < 0 || XDGAEventBase == 0)
|
||||
if (DGAScreenKey == NULL || XDGAEventBase == 0)
|
||||
return;
|
||||
pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
|
||||
#ifdef DPMSExtension
|
||||
static int DPMSGeneration = 0;
|
||||
static int DPMSIndex = -1;
|
||||
static DevPrivateKey DPMSKey = NULL;
|
||||
static Bool DPMSClose(int i, ScreenPtr pScreen);
|
||||
static int DPMSCount = 0;
|
||||
#endif
|
||||
|
@ -62,18 +61,15 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
|
|||
DPMSPtr pDPMS;
|
||||
pointer DPMSOpt;
|
||||
|
||||
if (serverGeneration != DPMSGeneration) {
|
||||
if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0)
|
||||
return FALSE;
|
||||
DPMSGeneration = serverGeneration;
|
||||
}
|
||||
DPMSKey = &DPMSKey;
|
||||
|
||||
if (DPMSDisabledSwitch)
|
||||
DPMSEnabled = FALSE;
|
||||
if (!(pScreen->devPrivates[DPMSIndex].ptr = xcalloc(sizeof(DPMSRec), 1)))
|
||||
if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
|
||||
xcalloc(sizeof(DPMSRec), 1)))
|
||||
return FALSE;
|
||||
|
||||
pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
|
||||
pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
|
||||
pScrn->DPMSSet = set;
|
||||
pDPMS->Flags = flags;
|
||||
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
|
||||
|
@ -110,10 +106,10 @@ DPMSClose(int i, ScreenPtr pScreen)
|
|||
DPMSPtr pDPMS;
|
||||
|
||||
/* This shouldn't happen */
|
||||
if (DPMSIndex < 0)
|
||||
if (DPMSKey == NULL)
|
||||
return FALSE;
|
||||
|
||||
pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr;
|
||||
pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
|
||||
|
||||
/* This shouldn't happen */
|
||||
if (!pDPMS)
|
||||
|
@ -132,9 +128,9 @@ DPMSClose(int i, ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
xfree((pointer)pDPMS);
|
||||
pScreen->devPrivates[DPMSIndex].ptr = NULL;
|
||||
dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL);
|
||||
if (--DPMSCount == 0)
|
||||
DPMSIndex = -1;
|
||||
DPMSKey = NULL;
|
||||
return pScreen->CloseScreen(i, pScreen);
|
||||
}
|
||||
|
||||
|
@ -153,7 +149,7 @@ DPMSSet(ClientPtr client, int level)
|
|||
|
||||
DPMSPowerLevel = level;
|
||||
|
||||
if (DPMSIndex < 0)
|
||||
if (DPMSKey == NULL)
|
||||
return Success;
|
||||
|
||||
if (level != DPMSModeOn) {
|
||||
|
@ -165,7 +161,8 @@ DPMSSet(ClientPtr client, int level)
|
|||
/* For each screen, set the DPMS level */
|
||||
for (i = 0; i < xf86NumScreens; i++) {
|
||||
pScrn = xf86Screens[i];
|
||||
pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
|
||||
pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
|
||||
DPMSKey);
|
||||
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
|
||||
xf86EnableAccess(pScrn);
|
||||
pScrn->DPMSSet(pScrn, level, 0);
|
||||
|
@ -186,14 +183,15 @@ DPMSSupported(void)
|
|||
DPMSPtr pDPMS;
|
||||
ScrnInfoPtr pScrn;
|
||||
|
||||
if (DPMSIndex < 0) {
|
||||
if (DPMSKey == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* For each screen, check if DPMS is supported */
|
||||
for (i = 0; i < xf86NumScreens; i++) {
|
||||
pScrn = xf86Screens[i];
|
||||
pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr;
|
||||
pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
|
||||
DPMSKey);
|
||||
if (pDPMS && pScrn->DPMSSet)
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -46,10 +46,12 @@
|
|||
|
||||
/* Globals that video drivers may access */
|
||||
|
||||
_X_EXPORT int xf86ScreenIndex = -1; /* Index of ScrnInfo in pScreen.devPrivates */
|
||||
int xf86CreateRootWindowIndex = -1; /* Index into pScreen.devPrivates */
|
||||
/* Index into pScreen.devPrivates */
|
||||
DevPrivateKey xf86CreateRootWindowKey = &xf86CreateRootWindowKey;
|
||||
/* Index of ScrnInfo in pScreen.devPrivates */
|
||||
_X_EXPORT DevPrivateKey xf86ScreenKey = &xf86ScreenKey;
|
||||
_X_EXPORT DevPrivateKey xf86PixmapKey = &xf86PixmapKey;
|
||||
_X_EXPORT ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
|
||||
_X_EXPORT int xf86PixmapIndex = 0;
|
||||
_X_EXPORT const unsigned char byte_reversed[256] =
|
||||
{
|
||||
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
|
|
|
@ -139,8 +139,8 @@ xf86CreateRootWindow(WindowPtr pWin)
|
|||
int err = Success;
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
RootWinPropPtr pProp;
|
||||
CreateWindowProcPtr CreateWindow =
|
||||
(CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr);
|
||||
CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
|
||||
dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
|
||||
|
||||
#ifdef DEBUG
|
||||
ErrorF("xf86CreateRootWindow(%p)\n", pWin);
|
||||
|
@ -156,7 +156,7 @@ xf86CreateRootWindow(WindowPtr pWin)
|
|||
|
||||
/* Unhook this function ... */
|
||||
pScreen->CreateWindow = CreateWindow;
|
||||
pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL;
|
||||
dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
|
||||
|
||||
/* ... and call the previous CreateWindow fuction, if any */
|
||||
if (NULL!=pScreen->CreateWindow) {
|
||||
|
@ -476,7 +476,6 @@ void
|
|||
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||
{
|
||||
int i, j, k, scr_index;
|
||||
static unsigned long generation = 0;
|
||||
char **modulelist;
|
||||
pointer *optionlist;
|
||||
screenLayoutPtr layout;
|
||||
|
@ -487,14 +486,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
|||
|
||||
xf86Initialising = TRUE;
|
||||
|
||||
/* Do this early? */
|
||||
if (generation != serverGeneration) {
|
||||
xf86ScreenIndex = AllocateScreenPrivateIndex();
|
||||
xf86CreateRootWindowIndex = AllocateScreenPrivateIndex();
|
||||
xf86PixmapIndex = AllocatePixmapPrivateIndex();
|
||||
generation = serverGeneration;
|
||||
}
|
||||
|
||||
if (serverGeneration == 1) {
|
||||
|
||||
pScreenInfo->numScreens = 0;
|
||||
|
@ -1060,8 +1051,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
|||
* Hook in our ScrnInfoRec, and initialise some other pScreen
|
||||
* fields.
|
||||
*/
|
||||
screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr
|
||||
= (pointer)xf86Screens[i];
|
||||
dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
|
||||
xf86ScreenKey, xf86Screens[i]);
|
||||
xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
|
||||
/* The driver should set this, but make sure it is set anyway */
|
||||
xf86Screens[i]->vtSema = TRUE;
|
||||
|
@ -1077,8 +1068,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
|||
i, xf86Screens[i]->pScreen->CreateWindow );
|
||||
#endif
|
||||
|
||||
screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr
|
||||
= (void*)(xf86Screens[i]->pScreen->CreateWindow);
|
||||
dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
|
||||
xf86CreateRootWindowKey,
|
||||
xf86Screens[i]->pScreen->CreateWindow);
|
||||
xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
|
||||
|
||||
#ifdef RENDER
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue