summaryrefslogtreecommitdiff
path: root/miext
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-08-28 09:28:25 -0400
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-08-28 09:28:25 -0400
commit4017d3190234e189a0bbd33193a148d4d3c7556b (patch)
tree2ab228113d410386afde50c893f137d95974b8f3 /miext
parent85547073265ae9bc4ae3af920a6d3214fd1ca0c5 (diff)
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.
Diffstat (limited to 'miext')
-rw-r--r--miext/cw/cw.c51
-rw-r--r--miext/cw/cw.h29
-rwxr-xr-xmiext/damage/damage.c41
-rwxr-xr-xmiext/damage/damagestr.h15
-rw-r--r--miext/rootless/accel/rlAccel.c13
-rw-r--r--miext/rootless/rootlessCommon.h19
-rw-r--r--miext/rootless/rootlessGC.c10
-rw-r--r--miext/rootless/rootlessScreen.c30
-rw-r--r--miext/rootless/rootlessWindow.c12
-rw-r--r--miext/shadow/shadow.c15
-rw-r--r--miext/shadow/shadow.h5
11 files changed, 88 insertions, 152 deletions
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index b03f5e3a8..df4b121d8 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -43,13 +43,12 @@
#define CW_ASSERT(x) do {} while (0)
#endif
-int cwGCIndex;
-int cwScreenIndex;
-int cwWindowIndex;
+DevPrivateKey cwGCKey = &cwGCKey;
+DevPrivateKey cwScreenKey = &cwScreenKey;
+DevPrivateKey cwWindowKey = &cwWindowKey;
#ifdef RENDER
-int cwPictureIndex;
+DevPrivateKey cwPictureKey = &cwPictureKey;
#endif
-static unsigned long cwGeneration = 0;
extern GCOps cwGCOps;
static Bool
@@ -237,7 +236,7 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
static void
cwChangeGC(GCPtr pGC, unsigned long mask)
{
- cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr;
+ cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
FUNC_PROLOGUE(pGC, pPriv);
@@ -249,7 +248,7 @@ cwChangeGC(GCPtr pGC, unsigned long mask)
static void
cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
{
- cwGCPtr pPriv = (cwGCPtr)(pGCDst)->devPrivates[cwGCIndex].ptr;
+ cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGCDst->devPrivates, cwGCKey);
FUNC_PROLOGUE(pGCDst, pPriv);
@@ -261,7 +260,7 @@ cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
static void
cwDestroyGC(GCPtr pGC)
{
- cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr;
+ cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
FUNC_PROLOGUE(pGC, pPriv);
@@ -275,7 +274,7 @@ cwDestroyGC(GCPtr pGC)
static void
cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
- cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr;
+ cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
FUNC_PROLOGUE(pGC, pPriv);
@@ -287,7 +286,7 @@ cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
static void
cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
- cwGCPtr pPriv = (cwGCPtr)(pgcDst)->devPrivates[cwGCIndex].ptr;
+ cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pgcDst->devPrivates, cwGCKey);
FUNC_PROLOGUE(pgcDst, pPriv);
@@ -299,7 +298,7 @@ cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
static void
cwDestroyClip(GCPtr pGC)
{
- cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr;
+ cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
FUNC_PROLOGUE(pGC, pPriv);
@@ -621,34 +620,14 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
Bool has_render = GetPictureScreenIfSet(pScreen) != NULL;
#endif
- if (cwGeneration != serverGeneration)
- {
- cwScreenIndex = AllocateScreenPrivateIndex();
- if (cwScreenIndex < 0)
- return;
- cwGCIndex = AllocateGCPrivateIndex();
- cwWindowIndex = AllocateWindowPrivateIndex();
-#ifdef RENDER
- if (has_render)
- cwPictureIndex = AllocatePicturePrivateIndex();
-#endif
- cwGeneration = serverGeneration;
- }
- if (!AllocateGCPrivate(pScreen, cwGCIndex, sizeof(cwGCRec)))
- return;
- if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0))
+ if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec)))
return;
-#ifdef RENDER
- if (has_render) {
- if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
- return;
- }
-#endif
+
pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec));
if (!pScreenPriv)
return;
- pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, cwScreenKey, pScreenPriv);
SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen);
SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage);
@@ -675,8 +654,8 @@ cwCloseScreen (int i, ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- pScreenPriv = (cwScreenPtr)pScreen->devPrivates[cwScreenIndex].ptr;
-
+ pScreenPriv = (cwScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ cwScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->GetImage = pScreenPriv->GetImage;
pScreen->GetSpans = pScreenPriv->GetSpans;
diff --git a/miext/cw/cw.h b/miext/cw/cw.h
index 0d57b9b9d..45247d670 100644
--- a/miext/cw/cw.h
+++ b/miext/cw/cw.h
@@ -26,6 +26,7 @@
#include "gcstruct.h"
#include "picturestr.h"
+#include "privates.h"
/*
* One of these structures is allocated per GC that gets used with a window with
@@ -43,10 +44,10 @@ typedef struct {
GCFuncs *wrapFuncs; /* wrapped funcs */
} cwGCRec, *cwGCPtr;
-extern int cwGCIndex;
+extern DevPrivateKey cwGCKey;
-#define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr)
-#define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (pointer) (p))
+#define getCwGC(pGC) ((cwGCPtr)dixLookupPrivate(&(pGC)->devPrivates, cwGCKey))
+#define setCwGC(pGC,p) dixSetPrivate(&(pGC)->devPrivates, cwGCKey, p)
/*
* One of these structures is allocated per Picture that gets used with a
@@ -59,17 +60,17 @@ typedef struct {
unsigned long stateChanges;
} cwPictureRec, *cwPicturePtr;
-#define getCwPicture(pPicture) \
- (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0)
-#define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p))
+#define getCwPicture(pPicture) (pPicture->pDrawable ? \
+ (cwPicturePtr)dixLookupPrivate(&(pPicture)->devPrivates, cwPictureKey) : 0)
+#define setCwPicture(pPicture,p) dixSetPrivate(&(pPicture)->devPrivates, cwPictureKey, p)
-extern int cwPictureIndex;
+extern DevPrivateKey cwPictureKey;
+extern DevPrivateKey cwWindowKey;
-extern int cwWindowIndex;
-
-#define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr)
+#define cwWindowPrivate(pWin) dixLookupPrivate(&(pWin)->devPrivates, cwWindowKey)
#define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
-#define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap))
+#define setCwPixmap(pWindow,pPixmap) \
+ dixSetPrivate(&(pWindow)->devPrivates, cwWindowKey, pPixmap)
#define cwDrawableIsRedirWindow(pDraw) \
((pDraw)->type == DRAWABLE_WINDOW && \
@@ -112,10 +113,10 @@ typedef struct {
#endif
} cwScreenRec, *cwScreenPtr;
-extern int cwScreenIndex;
+extern DevPrivateKey cwScreenKey;
-#define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr)
-#define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p))
+#define getCwScreen(pScreen) ((cwScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, cwScreenKey))
+#define setCwScreen(pScreen,p) dixSetPrivate(&(pScreen)->devPrivates, cwScreenKey, p)
#define CW_OFFSET_XYPOINTS(ppt, npt) do { \
DDXPointPtr _ppt = (DDXPointPtr)(ppt); \
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 65314d8a9..b7f6fb550 100755
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -65,16 +65,15 @@
#define DAMAGE_DEBUG(x)
#endif
-#define getPixmapDamageRef(pPixmap) \
- ((DamagePtr *) &(pPixmap->devPrivates[damagePixPrivateIndex].ptr))
+#define getPixmapDamageRef(pPixmap) ((DamagePtr *) \
+ dixLookupPrivateAddr(&(pPixmap)->devPrivates, damagePixPrivateKey))
#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
-static int damageScrPrivateIndex;
-static int damagePixPrivateIndex;
-static int damageGCPrivateIndex;
-static int damageWinPrivateIndex;
-static int damageGeneration;
+static DevPrivateKey damageScrPrivateKey = &damageScrPrivateKey;
+static DevPrivateKey damagePixPrivateKey = &damagePixPrivateKey;
+static DevPrivateKey damageGCPrivateKey = &damageGCPrivateKey;
+static DevPrivateKey damageWinPrivateKey = &damageWinPrivateKey;
static DamagePtr *
getDrawableDamageRef (DrawablePtr pDrawable)
@@ -115,7 +114,7 @@ getDrawableDamageRef (DrawablePtr pDrawable)
#define winDamageRef(pWindow) \
DamagePtr *pPrev = (DamagePtr *) \
- &(pWindow->devPrivates[damageWinPrivateIndex].ptr)
+ dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
static void
DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
@@ -1779,30 +1778,10 @@ DamageSetup (ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- if (damageGeneration != serverGeneration)
- {
- damageScrPrivateIndex = AllocateScreenPrivateIndex ();
- if (damageScrPrivateIndex == -1)
- return FALSE;
- damageGCPrivateIndex = AllocateGCPrivateIndex ();
- if (damageGCPrivateIndex == -1)
- return FALSE;
- damagePixPrivateIndex = AllocatePixmapPrivateIndex ();
- if (damagePixPrivateIndex == -1)
- return FALSE;
- damageWinPrivateIndex = AllocateWindowPrivateIndex ();
- if (damageWinPrivateIndex == -1)
- return FALSE;
- damageGeneration = serverGeneration;
- }
- if (pScreen->devPrivates[damageScrPrivateIndex].ptr)
+ if (dixLookupPrivate(&pScreen->devPrivates, damageScrPrivateKey))
return TRUE;
- if (!AllocateGCPrivate (pScreen, damageGCPrivateIndex, sizeof (DamageGCPrivRec)))
- return FALSE;
- if (!AllocatePixmapPrivate (pScreen, damagePixPrivateIndex, 0))
- return FALSE;
- if (!AllocateWindowPrivate (pScreen, damageWinPrivateIndex, 0))
+ if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec)))
return FALSE;
pScrPriv = (DamageScrPrivPtr) xalloc (sizeof (DamageScrPrivRec));
@@ -1827,7 +1806,7 @@ DamageSetup (ScreenPtr pScreen)
}
#endif
- pScreen->devPrivates[damageScrPrivateIndex].ptr = (pointer) pScrPriv;
+ dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, pScrPriv);
return TRUE;
}
diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h
index 1e0efad4f..9f3dd6684 100755
--- a/miext/damage/damagestr.h
+++ b/miext/damage/damagestr.h
@@ -29,6 +29,7 @@
#include "damage.h"
#include "gcstruct.h"
+#include "privates.h"
#ifdef RENDER
# include "picturestr.h"
#endif
@@ -80,31 +81,31 @@ typedef struct _damageGCPriv {
} DamageGCPrivRec, *DamageGCPrivPtr;
/* XXX should move these into damage.c, damageScrPrivateIndex is static */
-#define damageGetScrPriv(pScr) \
- ((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr)
+#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \
+ dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey))
#define damageScrPriv(pScr) \
DamageScrPrivPtr pScrPriv = damageGetScrPriv(pScr)
#define damageGetPixPriv(pPix) \
- ((DamagePtr) (pPix)->devPrivates[damagePixPrivateIndex].ptr)
+ dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey)
#define damgeSetPixPriv(pPix,v) \
- ((pPix)->devPrivates[damagePixPrivateIndex].ptr = (pointer ) (v))
+ dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v)
#define damagePixPriv(pPix) \
DamagePtr pDamage = damageGetPixPriv(pPix)
#define damageGetGCPriv(pGC) \
- ((DamageGCPrivPtr) (pGC)->devPrivates[damageGCPrivateIndex].ptr)
+ dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey)
#define damageGCPriv(pGC) \
DamageGCPrivPtr pGCPriv = damageGetGCPriv(pGC)
#define damageGetWinPriv(pWin) \
- ((DamagePtr) (pWin)->devPrivates[damageWinPrivateIndex].ptr)
+ ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey))
#define damageSetWinPriv(pWin,d) \
- ((pWin)->devPrivates[damageWinPrivateIndex].ptr = (d))
+ dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d)
#endif /* _DAMAGESTR_H_ */
diff --git a/miext/rootless/accel/rlAccel.c b/miext/rootless/accel/rlAccel.c
index d62bee740..a14412416 100644
--- a/miext/rootless/accel/rlAccel.c
+++ b/miext/rootless/accel/rlAccel.c
@@ -46,10 +46,10 @@ typedef struct _rlAccelScreenRec {
CloseScreenProcPtr CloseScreen;
} rlAccelScreenRec, *rlAccelScreenPtr;
-static int rlAccelScreenPrivateIndex = -1;
+static DevPrivateKey rlAccelScreenPrivateKey = &rlAccelScreenPrivateKey;
-#define RLACCELREC(pScreen) \
- ((rlAccelScreenRec *)(pScreen)->devPrivates[rlAccelScreenPrivateIndex].ptr)
+#define RLACCELREC(pScreen) ((rlAccelScreenRec *) \
+ dixLookupPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey))
/* This is mostly identical to fbGCOps. */
static GCOps rlAccelOps = {
@@ -128,15 +128,8 @@ rlCloseScreen (int iScreen, ScreenPtr pScreen)
Bool
RootlessAccelInit(ScreenPtr pScreen)
{
- static unsigned long rlAccelGeneration = 0;
rlAccelScreenRec *s;
- if (rlAccelGeneration != serverGeneration) {
- rlAccelScreenPrivateIndex = AllocateScreenPrivateIndex();
- if (rlAccelScreenPrivateIndex == -1) return FALSE;
- rlAccelGeneration = serverGeneration;
- }
-
s = xalloc(sizeof(rlAccelScreenRec));
if (!s) return FALSE;
RLACCELREC(pScreen) = s;
diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index 3bf6af02f..5ebe35e63 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -52,9 +52,9 @@
// Global variables
-extern int rootlessGCPrivateIndex;
-extern int rootlessScreenPrivateIndex;
-extern int rootlessWindowPrivateIndex;
+extern DevPrivateKey rootlessGCPrivateKey;
+extern DevPrivateKey rootlessScreenPrivateKey;
+extern DevPrivateKey rootlessWindowPrivateKey;
// RootlessGCRec: private per-gc data
@@ -133,12 +133,17 @@ typedef struct _RootlessScreenRec {
// Accessors for screen and window privates
-#define SCREENREC(pScreen) \
- ((RootlessScreenRec *)(pScreen)->devPrivates[rootlessScreenPrivateIndex].ptr)
+#define SCREENREC(pScreen) ((RootlessScreenRec *) \
+ dixLookupPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey))
-#define WINREC(pWin) \
- ((RootlessWindowRec *)(pWin)->devPrivates[rootlessWindowPrivateIndex].ptr)
+#define SETSCREENREC(pScreen, v) \
+ dixSetPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey, v)
+#define WINREC(pWin) ((RootlessWindowRec *) \
+ dixLookupPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey))
+
+#define SETWINREC(pWin, v) \
+ dixSetPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey, v)
// Call a rootless implementation function.
// Many rootless implementation functions are allowed to be NULL.
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index b26f52c54..bf129eadc 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -276,11 +276,11 @@ RootlessCreateGC(GCPtr pGC)
Bool result;
SCREEN_UNWRAP(pGC->pScreen, CreateGC);
- s = (RootlessScreenRec *) pGC->pScreen->
- devPrivates[rootlessScreenPrivateIndex].ptr;
+ s = SCREENREC(pGC->pScreen);
result = s->CreateGC(pGC);
- gcrec = (RootlessGCRec *) pGC->devPrivates[rootlessGCPrivateIndex].ptr;
+ gcrec = (RootlessGCRec *)
+ dixLookupPrivate(&pGC->devPrivates, rootlessGCPrivateKey);
gcrec->originalOps = NULL; // don't wrap ops yet
gcrec->originalFuncs = pGC->funcs;
pGC->funcs = &rootlessGCFuncs;
@@ -302,7 +302,7 @@ RootlessCreateGC(GCPtr pGC)
// does not assume ops have been wrapped
#define GCFUNC_UNWRAP(pGC) \
RootlessGCRec *gcrec = (RootlessGCRec *) \
- (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \
+ dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
(pGC)->funcs = gcrec->originalFuncs; \
if (gcrec->originalOps) { \
(pGC)->ops = gcrec->originalOps; \
@@ -399,7 +399,7 @@ static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
// assumes both funcs and ops are wrapped
#define GCOP_UNWRAP(pGC) \
RootlessGCRec *gcrec = (RootlessGCRec *) \
- (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \
+ dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \
GCFuncs *saveFuncs = pGC->funcs; \
(pGC)->funcs = gcrec->originalFuncs; \
(pGC)->ops = gcrec->originalOps;
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 700de6edc..f647893de 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -61,9 +61,9 @@ extern int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild,
extern Bool RootlessCreateGC(GCPtr pGC);
// Initialize globals
-int rootlessGCPrivateIndex = -1;
-int rootlessScreenPrivateIndex = -1;
-int rootlessWindowPrivateIndex = -1;
+DevPrivateKey rootlessGCPrivateKey = &rootlessGCPrivateKey;
+DevPrivateKey rootlessScreenPrivateKey = &rootlessScreenPrivateKey;
+DevPrivateKey rootlessWindowPrivateKey = &rootlessWindowPrivateKey;
/*
@@ -547,28 +547,14 @@ static Bool
RootlessAllocatePrivates(ScreenPtr pScreen)
{
RootlessScreenRec *s;
- static unsigned long rootlessGeneration = 0;
-
- if (rootlessGeneration != serverGeneration) {
- rootlessScreenPrivateIndex = AllocateScreenPrivateIndex();
- if (rootlessScreenPrivateIndex == -1) return FALSE;
- rootlessGCPrivateIndex = AllocateGCPrivateIndex();
- if (rootlessGCPrivateIndex == -1) return FALSE;
- rootlessWindowPrivateIndex = AllocateWindowPrivateIndex();
- if (rootlessWindowPrivateIndex == -1) return FALSE;
- rootlessGeneration = serverGeneration;
- }
// no allocation needed for screen privates
- if (!AllocateGCPrivate(pScreen, rootlessGCPrivateIndex,
- sizeof(RootlessGCRec)))
- return FALSE;
- if (!AllocateWindowPrivate(pScreen, rootlessWindowPrivateIndex, 0))
+ if (!dixRequestPrivate(rootlessGCPrivateKey, sizeof(RootlessGCRec)))
return FALSE;
s = xalloc(sizeof(RootlessScreenRec));
if (! s) return FALSE;
- SCREENREC(pScreen) = s;
+ SETSCREENREC(pScreen, s);
s->pixmap_data = NULL;
s->pixmap_data_size = 0;
@@ -583,8 +569,7 @@ RootlessAllocatePrivates(ScreenPtr pScreen)
static void
RootlessWrap(ScreenPtr pScreen)
{
- RootlessScreenRec *s = (RootlessScreenRec*)
- pScreen->devPrivates[rootlessScreenPrivateIndex].ptr;
+ RootlessScreenRec *s = SCREENREC(pScreen);
#define WRAP(a) \
if (pScreen->a) { \
@@ -650,8 +635,7 @@ Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs)
if (!RootlessAllocatePrivates(pScreen))
return FALSE;
- s = (RootlessScreenRec*)
- pScreen->devPrivates[rootlessScreenPrivateIndex].ptr;
+ s = SCREENREC(pScreen);
s->imp = procs;
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 30b7daaab..687748c2d 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -66,7 +66,7 @@ RootlessCreateWindow(WindowPtr pWin)
Bool result;
RegionRec saveRoot;
- WINREC(pWin) = NULL;
+ SETWINREC(pWin, NULL);
SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow);
@@ -107,7 +107,7 @@ RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
#endif
xfree(winRec);
- WINREC(pWin) = NULL;
+ SETWINREC(pWin, NULL);
}
@@ -353,7 +353,7 @@ RootlessEnsureFrame(WindowPtr pWin)
winRec->pixmap = NULL;
winRec->wid = NULL;
- WINREC(pWin) = winRec;
+ SETWINREC(pWin, winRec);
#ifdef SHAPE
// Set the frame's shape if the window is shaped
@@ -370,7 +370,7 @@ RootlessEnsureFrame(WindowPtr pWin)
{
RL_DEBUG_MSG("implementation failed to create frame!\n");
xfree(winRec);
- WINREC(pWin) = NULL;
+ SETWINREC(pWin, NULL);
return NULL;
}
@@ -1298,8 +1298,8 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
/* Switch the frame record from one to the other. */
- WINREC(pWin) = NULL;
- WINREC(pTopWin) = winRec;
+ SETWINREC(pWin, NULL);
+ SETWINREC(pTopWin, winRec);
RootlessInitializeFrame(pTopWin, winRec);
RootlessReshapeFrame(pTopWin);
diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index f624216db..74544b1a0 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -36,8 +36,7 @@
#include "gcstruct.h"
#include "shadow.h"
-int shadowScrPrivateIndex;
-int shadowGeneration;
+DevPrivateKey shadowScrPrivateKey = &shadowScrPrivateKey;
#define wrap(priv, real, mem) {\
priv->mem = real->mem; \
@@ -116,7 +115,8 @@ static void
shadowReportFunc(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
ScreenPtr pScreen = closure;
- shadowBufPtr pBuf = pScreen->devPrivates[shadowScrPrivateIndex].ptr;
+ shadowBufPtr pBuf = (shadowBufPtr)
+ dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey);
/* Register the damaged region, use DamageReportNone below when we
* want to break BC below... */
@@ -138,13 +138,6 @@ shadowSetup(ScreenPtr pScreen)
if (!DamageSetup(pScreen))
return FALSE;
- if (shadowGeneration != serverGeneration) {
- shadowScrPrivateIndex = AllocateScreenPrivateIndex();
- if (shadowScrPrivateIndex == -1)
- return FALSE;
- shadowGeneration = serverGeneration;
- }
-
pBuf = (shadowBufPtr) xalloc(sizeof(shadowBufRec));
if (!pBuf)
return FALSE;
@@ -175,7 +168,7 @@ shadowSetup(ScreenPtr pScreen)
REGION_NULL(pScreen, &pBuf->damage); /* bc */
#endif
- pScreen->devPrivates[shadowScrPrivateIndex].ptr = (pointer) pBuf;
+ dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf);
return TRUE;
}
diff --git a/miext/shadow/shadow.h b/miext/shadow/shadow.h
index 8986809f4..2e45df2b5 100644
--- a/miext/shadow/shadow.h
+++ b/miext/shadow/shadow.h
@@ -74,9 +74,10 @@ typedef struct _shadowBuf {
#define SHADOW_REFLECT_Y 32
#define SHADOW_REFLECT_ALL (SHADOW_REFLECT_X|SHADOW_REFLECT_Y)
-extern int shadowScrPrivateIndex;
+extern DevPrivateKey shadowScrPrivateKey;
-#define shadowGetBuf(pScr) ((shadowBufPtr) (pScr)->devPrivates[shadowScrPrivateIndex].ptr)
+#define shadowGetBuf(pScr) ((shadowBufPtr) \
+ dixLookupPrivate(&(pScr)->devPrivates, shadowScrPrivateKey))
#define shadowBuf(pScr) shadowBufPtr pBuf = shadowGetBuf(pScr)
#define shadowDamage(pBuf) DamageRegion(pBuf->pDamage)