From 4017d3190234e189a0bbd33193a148d4d3c7556b Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 28 Aug 2007 09:28:25 -0400 Subject: 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. --- xfixes/cursor.c | 18 ++++-------------- xfixes/xfixes.c | 6 ++---- xfixes/xfixesint.h | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) (limited to 'xfixes') 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); -- cgit v1.2.3