summaryrefslogtreecommitdiff
path: root/xfixes
diff options
context:
space:
mode:
Diffstat (limited to 'xfixes')
-rwxr-xr-xxfixes/cursor.c18
-rwxr-xr-xxfixes/xfixes.c6
-rwxr-xr-xxfixes/xfixesint.h2
3 files changed, 7 insertions, 19 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 450f366f2..975ebc36d 100755
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -55,8 +55,7 @@
static RESTYPE CursorClientType;
static RESTYPE CursorHideCountType;
static RESTYPE CursorWindowType;
-static int CursorScreenPrivateIndex = -1;
-static int CursorGeneration;
+static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKey;
static CursorPtr CursorCurrent;
static CursorPtr pInvisibleCursor = NULL;
@@ -113,9 +112,9 @@ typedef struct _CursorScreen {
CursorHideCountPtr pCursorHideCounts;
} CursorScreenRec, *CursorScreenPtr;
-#define GetCursorScreen(s) ((CursorScreenPtr) ((s)->devPrivates[CursorScreenPrivateIndex].ptr))
-#define GetCursorScreenIfSet(s) ((CursorScreenPrivateIndex != -1) ? GetCursorScreen(s) : NULL)
-#define SetCursorScreen(s,p) ((s)->devPrivates[CursorScreenPrivateIndex].ptr = (pointer) (p))
+#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
+#define GetCursorScreenIfSet(s) GetCursorScreen(s)
+#define SetCursorScreen(s,p) dixSetPrivate(&(s)->devPrivates, CursorScreenPrivateKey, p)
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
@@ -171,8 +170,6 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
deleteCursorHideCountsForScreen(pScreen);
ret = (*pScreen->CloseScreen) (index, pScreen);
xfree (cs);
- if (index == 0)
- CursorScreenPrivateIndex = -1;
return ret;
}
@@ -1011,13 +1008,6 @@ XFixesCursorInit (void)
{
int i;
- if (CursorGeneration != serverGeneration)
- {
- CursorScreenPrivateIndex = AllocateScreenPrivateIndex ();
- if (CursorScreenPrivateIndex < 0)
- return FALSE;
- CursorGeneration = serverGeneration;
- }
for (i = 0; i < screenInfo.numScreens; i++)
{
ScreenPtr pScreen = screenInfo.screens[i];
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index 32dee8a18..0db49895e 100755
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -56,7 +56,7 @@
static unsigned char XFixesReqCode;
int XFixesEventBase;
int XFixesErrorBase;
-static int XFixesClientPrivateIndex;
+static DevPrivateKey XFixesClientPrivateKey = &XFixesClientPrivateKey;
static int
ProcXFixesQueryVersion(ClientPtr client)
@@ -239,9 +239,7 @@ XFixesExtensionInit(void)
{
ExtensionEntry *extEntry;
- XFixesClientPrivateIndex = AllocateClientPrivateIndex ();
- if (!AllocateClientPrivate (XFixesClientPrivateIndex,
- sizeof (XFixesClientRec)))
+ if (!dixRequestPrivate(XFixesClientPrivateKey, sizeof (XFixesClientRec)))
return;
if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
return;
diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
index 48927ae0f..33a3205ed 100755
--- a/xfixes/xfixesint.h
+++ b/xfixes/xfixesint.h
@@ -66,7 +66,7 @@ typedef struct _XFixesClient {
CARD32 minor_version;
} XFixesClientRec, *XFixesClientPtr;
-#define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr)
+#define GetXFixesClient(pClient) ((XFixesClientPtr)dixLookupPrivate(&(pClient)->devPrivates, XFixesClientPrivateKey))
extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr);