summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
Diffstat (limited to 'mi')
-rw-r--r--mi/mi.h3
-rw-r--r--mi/mibank.c18
-rw-r--r--mi/midispcur.c56
-rw-r--r--mi/mieq.c4
-rw-r--r--mi/miinitext.c18
-rw-r--r--mi/miline.h8
-rw-r--r--mi/mioverlay.c27
-rw-r--r--mi/mipointer.c15
-rw-r--r--mi/mipointer.h3
-rw-r--r--mi/miscrinit.c25
-rw-r--r--mi/misprite.c78
11 files changed, 115 insertions, 140 deletions
diff --git a/mi/mi.h b/mi/mi.h
index c71c9b7c0..8d8f488a0 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -55,6 +55,7 @@ SOFTWARE.
#include <X11/fonts/font.h>
#include "input.h"
#include "cursor.h"
+#include "privates.h"
#define MiBits CARD32
@@ -412,7 +413,7 @@ extern Bool miScreenInit(
VisualPtr /*visuals*/
);
-extern int miAllocateGCPrivateIndex(
+extern DevPrivateKey miAllocateGCPrivateIndex(
void
);
diff --git a/mi/mibank.c b/mi/mibank.c
index 859770cc2..ea79e9d36 100644
--- a/mi/mibank.c
+++ b/mi/mibank.c
@@ -175,15 +175,15 @@ typedef struct _miBankQueue
#define xalloc_ARRAY(atype, ntype) \
(atype *)xalloc((ntype) * sizeof(atype))
-static int miBankScreenIndex;
-static int miBankGCIndex;
+static DevPrivateKey miBankScreenKey = &miBankScreenKey;
+static DevPrivateKey miBankGCKey = &miBankGCKey;
static unsigned long miBankGeneration = 0;
-#define BANK_SCRPRIVLVAL pScreen->devPrivates[miBankScreenIndex].ptr
+#define BANK_SCRPRIVLVAL dixLookupPrivate(&pScreen->devPrivates, miBankScreenKey)
#define BANK_SCRPRIVATE ((miBankScreenPtr)(BANK_SCRPRIVLVAL))
-#define BANK_GCPRIVLVAL(pGC) (pGC)->devPrivates[miBankGCIndex].ptr
+#define BANK_GCPRIVLVAL(pGC) dixLookupPrivate(&(pGC)->devPrivates, miBankGCKey)
#define BANK_GCPRIVATE(pGC) ((miBankGCPtr)(BANK_GCPRIVLVAL(pGC)))
@@ -2047,15 +2047,9 @@ miInitializeBanking(
/* Private areas */
if (miBankGeneration != serverGeneration)
- {
- if (((miBankScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((miBankGCIndex = AllocateGCPrivateIndex()) < 0))
- return FALSE;
-
miBankGeneration = serverGeneration;
- }
- if (!AllocateGCPrivate(pScreen, miBankGCIndex,
+ if (!dixRequestPrivate(miBankGCKey,
(nBanks * sizeof(RegionPtr)) +
(sizeof(miBankGCRec) - sizeof(RegionPtr))))
return FALSE;
@@ -2202,7 +2196,7 @@ miInitializeBanking(
SCREEN_WRAP(CreateGC, miBankCreateGC);
SCREEN_WRAP(CopyWindow, miBankCopyWindow);
- BANK_SCRPRIVLVAL = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, miBankScreenKey, pScreenPriv);
return TRUE;
}
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;
}
diff --git a/mi/mieq.c b/mi/mieq.c
index 20c4b6201..d946e7d04 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -200,13 +200,13 @@ mieqProcessInputEvents(void)
while (miEventQueue.head != miEventQueue.tail) {
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+ dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
else if (DPMSPowerLevel != DPMSModeOn)
SetScreenSaverTimer();
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
e = &miEventQueue.events[miEventQueue.head];
diff --git a/mi/miinitext.c b/mi/miinitext.c
index f5654f6bc..d06ab8ad1 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -248,6 +248,9 @@ typedef void (*InitExtension)(INITARGS);
#include "securitysrv.h"
#include <X11/extensions/securstr.h>
#endif
+#ifdef XSELINUX
+#include "xselinux.h"
+#endif
#ifdef PANORAMIX
#include <X11/extensions/panoramiXproto.h>
#endif
@@ -318,9 +321,11 @@ extern void XagExtensionInit(INITARGS);
extern void XaceExtensionInit(INITARGS);
#endif
#ifdef XCSECURITY
-extern void SecurityExtensionSetup(INITARGS);
extern void SecurityExtensionInit(INITARGS);
#endif
+#ifdef XSELINUX
+extern void XSELinuxExtensionInit(INITARGS);
+#endif
#ifdef XPRINT
extern void XpExtensionInit(INITARGS);
#endif
@@ -523,9 +528,6 @@ InitExtensions(argc, argv)
int argc;
char *argv[];
{
-#ifdef XCSECURITY
- SecurityExtensionSetup();
-#endif
#ifdef PANORAMIX
# if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
if (!noPanoramiXExtension) PanoramiXExtensionInit();
@@ -594,6 +596,9 @@ InitExtensions(argc, argv)
#ifdef XCSECURITY
if (!noSecurityExtension) SecurityExtensionInit();
#endif
+#ifdef XSELINUX
+ XSELinuxExtensionInit();
+#endif
#ifdef XPRINT
XpExtensionInit(); /* server-specific extension, cannot be disabled */
#endif
@@ -686,7 +691,10 @@ static ExtensionModule staticExtensions[] = {
{ XaceExtensionInit, XACE_EXTENSION_NAME, NULL, NULL, NULL },
#endif
#ifdef XCSECURITY
- { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, SecurityExtensionSetup, NULL },
+ { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
+#endif
+#ifdef XSELINUX
+ { XSELinuxExtensionInit, XSELINUX_EXTENSION_NAME, NULL, NULL, NULL },
#endif
#ifdef XPRINT
{ XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
diff --git a/mi/miline.h b/mi/miline.h
index b97b8cf9d..036c2b5df 100644
--- a/mi/miline.h
+++ b/mi/miline.h
@@ -28,6 +28,7 @@ in this Software without prior written authorization from The Open Group.
#ifndef MILINE_H
#include "screenint.h"
+#include "privates.h"
/*
* Public definitions used for configuring basic pixelization aspects
@@ -119,9 +120,8 @@ extern void miSetZeroLineBias(
t = y1; y1 = y2; y2 = t;\
}
-#define miGetZeroLineBias(_pScreen) \
- ((miZeroLineScreenIndex < 0) ? \
- 0 : ((_pScreen)->devPrivates[miZeroLineScreenIndex].uval))
+#define miGetZeroLineBias(_pScreen) ((unsigned long) \
+ dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey))
#define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \
(_octant) = 0; \
@@ -148,7 +148,7 @@ extern void miSetZeroLineBias(
#define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING)
#define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING)
-extern int miZeroLineScreenIndex;
+extern DevPrivateKey miZeroLineScreenKey;
extern int miZeroClipLine(
int /*xmin*/,
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index 1dd28b85b..a0adac54d 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -10,6 +10,7 @@
#include "mi.h"
#include "gcstruct.h"
#include "regionstr.h"
+#include "privates.h"
#include "mivalidate.h"
#include "mioverlay.h"
#include "migc.h"
@@ -53,9 +54,8 @@ typedef struct {
Bool copyUnderlay;
} miOverlayScreenRec, *miOverlayScreenPtr;
-static unsigned long miOverlayGeneration = 0;
-static int miOverlayWindowIndex = -1;
-static int miOverlayScreenIndex = -1;
+static DevPrivateKey miOverlayWindowKey = &miOverlayWindowKey;
+static DevPrivateKey miOverlayScreenKey = &miOverlayScreenKey;
static void RebuildTree(WindowPtr);
static Bool HasUnderlayChildren(WindowPtr);
@@ -85,10 +85,10 @@ static void miOverlaySetShape(WindowPtr);
#endif
static void miOverlayChangeBorderWidth(WindowPtr, unsigned int);
-#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) \
- ((miOverlayScreenPtr)((pScreen)->devPrivates[miOverlayScreenIndex].ptr))
-#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) \
- ((miOverlayWindowPtr)((pWin)->devPrivates[miOverlayWindowIndex].ptr))
+#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \
+ dixLookupPrivate(&(pScreen)->devPrivates, miOverlayScreenKey))
+#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) ((miOverlayWindowPtr) \
+ dixLookupPrivate(&(pWin)->devPrivates, miOverlayWindowKey))
#define MIOVERLAY_GET_WINDOW_TREE(pWin) \
(MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree)
@@ -112,22 +112,13 @@ miInitOverlay(
if(!inOverlayFunc || !transFunc) return FALSE;
- if(miOverlayGeneration != serverGeneration) {
- if(((miOverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) ||
- ((miOverlayWindowIndex = AllocateWindowPrivateIndex()) < 0))
- return FALSE;
-
- miOverlayGeneration = serverGeneration;
- }
-
- if(!AllocateWindowPrivate(pScreen, miOverlayWindowIndex,
- sizeof(miOverlayWindowRec)))
+ if(!dixRequestPrivate(miOverlayWindowKey, sizeof(miOverlayWindowRec)))
return FALSE;
if(!(pScreenPriv = xalloc(sizeof(miOverlayScreenRec))))
return FALSE;
- pScreen->devPrivates[miOverlayScreenIndex].ptr = (pointer)pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
pScreenPriv->InOverlay = inOverlayFunc;
pScreenPriv->MakeTransparent = transFunc;
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 24ff4cc53..2c3c68913 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -41,10 +41,10 @@ in this Software without prior written authorization from The Open Group.
# include "dixstruct.h"
# include "inputstr.h"
-_X_EXPORT int miPointerScreenIndex;
-static unsigned long miPointerGeneration = 0;
+_X_EXPORT DevPrivateKey miPointerScreenKey = &miPointerScreenKey;
-#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr))
+#define GetScreenPrivate(s) ((miPointerScreenPtr) \
+ dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
#define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s)
/*
@@ -76,13 +76,6 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
{
miPointerScreenPtr pScreenPriv;
- if (miPointerGeneration != serverGeneration)
- {
- miPointerScreenIndex = AllocateScreenPrivateIndex();
- if (miPointerScreenIndex < 0)
- return FALSE;
- miPointerGeneration = serverGeneration;
- }
pScreenPriv = (miPointerScreenPtr) xalloc (sizeof (miPointerScreenRec));
if (!pScreenPriv)
return FALSE;
@@ -99,7 +92,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
pScreenPriv->showTransparent = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miPointerCloseScreen;
- pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv);
/*
* set up screen cursor method table
*/
diff --git a/mi/mipointer.h b/mi/mipointer.h
index 1bce42c26..e864fddf4 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -28,6 +28,7 @@ in this Software without prior written authorization from The Open Group.
#include "cursor.h"
#include "input.h"
+#include "privates.h"
typedef struct _miPointerSpriteFuncRec {
Bool (*RealizeCursor)(
@@ -166,6 +167,6 @@ extern void miPointerSetPosition(
extern void miPointerUpdateSprite(
DeviceIntPtr pDev);
-extern int miPointerScreenIndex;
+extern DevPrivateKey miPointerScreenKey;
#endif /* MIPOINTER_H */
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 7a9014aa8..a1fb2e2f6 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -293,35 +293,22 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
return miScreenDevPrivateInit(pScreen, width, pbits);
}
-_X_EXPORT int
+static DevPrivateKey privateKey = &privateKey;
+
+_X_EXPORT DevPrivateKey
miAllocateGCPrivateIndex()
{
- static int privateIndex = -1;
- static unsigned long miGeneration = 0;
-
- if (miGeneration != serverGeneration)
- {
- privateIndex = AllocateGCPrivateIndex();
- miGeneration = serverGeneration;
- }
- return privateIndex;
+ return privateKey;
}
-_X_EXPORT int miZeroLineScreenIndex;
-static unsigned int miZeroLineGeneration = 0;
+_X_EXPORT DevPrivateKey miZeroLineScreenKey;
_X_EXPORT void
miSetZeroLineBias(pScreen, bias)
ScreenPtr pScreen;
unsigned int bias;
{
- if (miZeroLineGeneration != serverGeneration)
- {
- miZeroLineScreenIndex = AllocateScreenPrivateIndex();
- miZeroLineGeneration = serverGeneration;
- }
- if (miZeroLineScreenIndex >= 0)
- pScreen->devPrivates[miZeroLineScreenIndex].uval = bias;
+ dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, (pointer)bias);
}
_X_EXPORT PixmapPtr
diff --git a/mi/misprite.c b/mi/misprite.c
index 0b402fa59..0af3368b6 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -67,8 +67,7 @@ in this Software without prior written authorization from The Open Group.
* screen wrappers
*/
-static int miSpriteScreenIndex;
-static unsigned long miSpriteGeneration = 0;
+static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKey;
static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
@@ -91,10 +90,9 @@ static void miSpriteStoreColors(ColormapPtr pMap, int ndef,
static void miSpriteComputeSaved(ScreenPtr pScreen);
-#define SCREEN_PROLOGUE(pScreen, field)\
- ((pScreen)->field = \
- ((miSpriteScreenPtr) (pScreen)->devPrivates[miSpriteScreenIndex].ptr)->field)
-
+#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
+ ((miSpriteScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
+ miSpriteScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field)\
((pScreen)->field = miSprite##field)
@@ -128,8 +126,8 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
ScreenPtr pScreen = closure;
miSpriteScreenPtr pScreenPriv;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
if (pScreenPriv->isUp &&
RECT_IN_REGION (pScreen, pRegion, &pScreenPriv->saved) != rgnOUT)
{
@@ -156,14 +154,6 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
if (!DamageSetup (pScreen))
return FALSE;
- if (miSpriteGeneration != serverGeneration)
- {
- miSpriteScreenIndex = AllocateScreenPrivateIndex ();
- if (miSpriteScreenIndex < 0)
- return FALSE;
- miSpriteGeneration = serverGeneration;
- }
-
pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec));
if (!pScreenPriv)
return FALSE;
@@ -214,7 +204,7 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pScreenPriv->colors[MASK_COLOR].red = 0;
pScreenPriv->colors[MASK_COLOR].green = 0;
pScreenPriv->colors[MASK_COLOR].blue = 0;
- pScreen->devPrivates[miSpriteScreenIndex].ptr = (pointer) pScreenPriv;
+ dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv);
pScreen->CloseScreen = miSpriteCloseScreen;
pScreen->GetImage = miSpriteGetImage;
@@ -247,8 +237,8 @@ miSpriteCloseScreen (i, pScreen)
{
miSpriteScreenPtr pScreenPriv;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->GetImage = pScreenPriv->GetImage;
pScreen->GetSpans = pScreenPriv->GetSpans;
@@ -278,8 +268,8 @@ miSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
SCREEN_PROLOGUE (pScreen, GetImage);
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
if (pDrawable->type == DRAWABLE_WINDOW &&
pScreenPriv->isUp &&
ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h))
@@ -308,8 +298,8 @@ miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
SCREEN_PROLOGUE (pScreen, GetSpans);
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp)
{
DDXPointPtr pts;
@@ -350,8 +340,8 @@ miSpriteSourceValidate (pDrawable, x, y, width, height)
SCREEN_PROLOGUE (pScreen, SourceValidate);
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp &&
ORG_OVERLAP(&pScreenPriv->saved, pDrawable->x, pDrawable->y,
x, y, width, height))
@@ -374,7 +364,8 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
SCREEN_PROLOGUE (pScreen, CopyWindow);
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
/*
* Damage will take care of destination check
*/
@@ -399,8 +390,8 @@ miSpriteBlockHandler (i, blockData, pTimeout, pReadmask)
ScreenPtr pScreen = screenInfo.screens[i];
miSpriteScreenPtr pPriv;
- pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
SCREEN_PROLOGUE(pScreen, BlockHandler);
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
@@ -421,8 +412,8 @@ miSpriteInstallColormap (pMap)
ScreenPtr pScreen = pMap->pScreen;
miSpriteScreenPtr pPriv;
- pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
SCREEN_PROLOGUE(pScreen, InstallColormap);
(*pScreen->InstallColormap) (pMap);
@@ -450,8 +441,8 @@ miSpriteStoreColors (pMap, ndef, pdef)
int updated;
VisualPtr pVisual;
- pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
-
+ pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
SCREEN_PROLOGUE(pScreen, StoreColors);
(*pScreen->StoreColors) (pMap, ndef, pdef);
@@ -518,7 +509,7 @@ static void
miSpriteFindColors (ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
- pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
CursorPtr pCursor;
xColorItem *sourceColor, *maskColor;
@@ -562,7 +553,8 @@ miSpriteRealizeCursor (pScreen, pCursor)
{
miSpriteScreenPtr pScreenPriv;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
if (pCursor == pScreenPriv->pCursor)
pScreenPriv->checkPixels = TRUE;
return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor);
@@ -575,7 +567,8 @@ miSpriteUnrealizeCursor (pScreen, pCursor)
{
miSpriteScreenPtr pScreenPriv;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor);
}
@@ -588,7 +581,8 @@ miSpriteSetCursor (pScreen, pCursor, x, y)
{
miSpriteScreenPtr pScreenPriv;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
if (!pCursor)
{
pScreenPriv->shouldBeUp = FALSE;
@@ -688,7 +682,8 @@ miSpriteMoveCursor (pScreen, x, y)
{
miSpriteScreenPtr pScreenPriv;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
miSpriteSetCursor (pScreen, pScreenPriv->pCursor, x, y);
}
@@ -703,7 +698,8 @@ miSpriteRemoveCursor (pScreen)
miSpriteScreenPtr pScreenPriv;
DamageDrawInternal (pScreen, TRUE);
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
miSpriteIsUpFALSE (pScreen, pScreenPriv);
pScreenPriv->pCacheWin = NullWindow;
if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pScreen,
@@ -732,7 +728,8 @@ miSpriteRestoreCursor (pScreen)
DamageDrawInternal (pScreen, TRUE);
miSpriteComputeSaved (pScreen);
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
pCursor = pScreenPriv->pCursor;
x = pScreenPriv->x - (int)pCursor->bits->xhot;
y = pScreenPriv->y - (int)pCursor->bits->yhot;
@@ -767,7 +764,8 @@ miSpriteComputeSaved (pScreen)
int wpad, hpad;
CursorPtr pCursor;
- pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
pCursor = pScreenPriv->pCursor;
x = pScreenPriv->x - (int)pCursor->bits->xhot;
y = pScreenPriv->y - (int)pCursor->bits->yhot;