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. --- randr/randr.c | 16 +++------------- randr/randrstr.h | 10 +++++----- 2 files changed, 8 insertions(+), 18 deletions(-) (limited to 'randr') diff --git a/randr/randr.c b/randr/randr.c index 958f9c192..bc2b995d2 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -56,9 +56,9 @@ static int SProcRRDispatch (ClientPtr pClient); int RREventBase; int RRErrorBase; RESTYPE RRClientType, RREventType; /* resource types for event masks */ -int RRClientPrivateIndex; +DevPrivateKey RRClientPrivateKey = &RRClientPrivateKey; -int rrPrivIndex = -1; +DevPrivateKey rrPrivKey = &rrPrivKey; static void RRClientCallback (CallbackListPtr *list, @@ -214,8 +214,6 @@ Bool RRInit (void) return TRUE; } -static int RRScreenGeneration; - Bool RRScreenInit(ScreenPtr pScreen) { rrScrPrivPtr pScrPriv; @@ -223,13 +221,6 @@ Bool RRScreenInit(ScreenPtr pScreen) if (!RRInit ()) return FALSE; - if (RRScreenGeneration != serverGeneration) - { - if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - RRScreenGeneration = serverGeneration; - } - pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec)); if (!pScrPriv) return FALSE; @@ -333,8 +324,7 @@ RRExtensionInit (void) if (RRNScreens == 0) return; - RRClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (RRClientPrivateIndex, + if (!dixRequestPrivate(RRClientPrivateKey, sizeof (RRClientRec) + screenInfo.numScreens * sizeof (RRTimesRec))) return; diff --git a/randr/randrstr.h b/randr/randrstr.h index bd19fe9d0..e8358bc0c 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -262,11 +262,11 @@ typedef struct _rrScrPriv { #endif } rrScrPrivRec, *rrScrPrivPtr; -extern int rrPrivIndex; +extern DevPrivateKey rrPrivKey; -#define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr) +#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey)) #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) -#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p)) +#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p) /* * each window has a list of clients requesting @@ -298,7 +298,7 @@ typedef struct _RRClient { } RRClientRec, *RRClientPtr; extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ -extern int RRClientPrivateIndex; +extern DevPrivateKey RRClientPrivateKey; extern RESTYPE RRCrtcType, RRModeType, RROutputType; #define LookupOutput(client,id,a) ((RROutputPtr) \ @@ -311,7 +311,7 @@ extern RESTYPE RRCrtcType, RRModeType, RROutputType; (SecurityLookupIDByType (client, id, \ RRModeType, a))) -#define GetRRClient(pClient) ((RRClientPtr) (pClient)->devPrivates[RRClientPrivateIndex].ptr) +#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey)) #define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient) /* Initialize the extension */ -- cgit v1.2.3