summaryrefslogtreecommitdiff
path: root/afb/afbscrinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'afb/afbscrinit.c')
-rw-r--r--afb/afbscrinit.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c
index 71e8d4c1e..8615d935b 100644
--- a/afb/afbscrinit.c
+++ b/afb/afbscrinit.c
@@ -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;