diff options
Diffstat (limited to 'mi/midispcur.c')
-rw-r--r-- | mi/midispcur.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/mi/midispcur.c b/mi/midispcur.c index 918e401a5..45e0e9abe 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -54,8 +54,7 @@ in this Software without prior written authorization from The Open Group. /* per-screen private data */ -static int miDCScreenIndex; -static unsigned long miDCGeneration = 0; +static DevPrivateKey miDCScreenKey = &miDCScreenKey; static Bool miDCCloseScreen(int index, ScreenPtr pScreen); @@ -117,13 +116,6 @@ miDCInitialize (pScreen, screenFuncs) { miDCScreenPtr pScreenPriv; - if (miDCGeneration != serverGeneration) - { - miDCScreenIndex = AllocateScreenPrivateIndex (); - if (miDCScreenIndex < 0) - return FALSE; - miDCGeneration = serverGeneration; - } pScreenPriv = (miDCScreenPtr) xalloc (sizeof (miDCScreenRec)); if (!pScreenPriv) return FALSE; @@ -149,7 +141,7 @@ miDCInitialize (pScreen, screenFuncs) pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miDCCloseScreen; - pScreen->devPrivates[miDCScreenIndex].ptr = (pointer) pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs)) { @@ -170,7 +162,8 @@ miDCCloseScreen (index, pScreen) { miDCScreenPtr pScreenPriv; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; tossGC (pScreenPriv->pSourceGC); tossGC (pScreenPriv->pMaskGC); @@ -194,7 +187,7 @@ miDCRealizeCursor (pScreen, pCursor) CursorPtr pCursor; { if (pCursor->bits->refcnt <= 1) - pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL); return TRUE; } @@ -295,7 +288,7 @@ miDCRealize ( xfree ((pointer) pPriv); return (miDCCursorPtr)NULL; } - pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv); return pPriv; } pPriv->pPicture = 0; @@ -313,7 +306,7 @@ miDCRealize ( xfree ((pointer) pPriv); return (miDCCursorPtr)NULL; } - pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv); /* create the two sets of bits, clipping as appropriate */ @@ -359,7 +352,8 @@ miDCUnrealizeCursor (pScreen, pCursor) { miDCCursorPtr pPriv; - pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; + pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, + pScreen); if (pPriv && (pCursor->bits->refcnt <= 1)) { if (pPriv->sourceBits) @@ -371,7 +365,7 @@ miDCUnrealizeCursor (pScreen, pCursor) FreePicture (pPriv->pPicture, 0); #endif xfree ((pointer) pPriv); - pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL); } return TRUE; } @@ -448,7 +442,8 @@ miDCMakeGC( gcvals[0] = IncludeInferiors; gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr)pWin, - GCSubwindowMode|GCGraphicsExposures, gcvals, &status); + GCSubwindowMode|GCGraphicsExposures, gcvals, &status, + (XID)0, serverClient); *ppGC = pGC; return pGC; } @@ -465,14 +460,16 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) miDCCursorPtr pPriv; WindowPtr pWin; - pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; + pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, + pScreen); if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pWin = WindowTable[pScreen->myNum]; #ifdef ARGB_CURSOR if (pPriv->pPicture) @@ -517,7 +514,8 @@ miDCSaveUnderCursor (pScreen, x, y, w, h) WindowPtr pWin; GCPtr pGC; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) @@ -549,7 +547,8 @@ miDCRestoreUnderCursor (pScreen, x, y, w, h) WindowPtr pWin; GCPtr pGC; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave) @@ -575,7 +574,8 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy) GCPtr pGC; int sourcex, sourcey, destx, desty, copyw, copyh; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; /* @@ -711,14 +711,16 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) XID gcval = FALSE; PixmapPtr pTemp; - pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; + pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, + pScreen); if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pWin = WindowTable[pScreen->myNum]; pTemp = pScreenPriv->pTemp; if (!pTemp || @@ -742,7 +744,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) if (!pScreenPriv->pMoveGC) { pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); if (!pScreenPriv->pMoveGC) return FALSE; } @@ -778,14 +780,14 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) if (!pScreenPriv->pPixSourceGC) { pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); if (!pScreenPriv->pPixSourceGC) return FALSE; } if (!pScreenPriv->pPixMaskGC) { pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); if (!pScreenPriv->pPixMaskGC) return FALSE; } |