diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-08-28 09:28:25 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2007-08-28 09:28:25 -0400 |
commit | 4017d3190234e189a0bbd33193a148d4d3c7556b (patch) | |
tree | 2ab228113d410386afde50c893f137d95974b8f3 /hw/xprint/ps/PsInit.c | |
parent | 85547073265ae9bc4ae3af920a6d3214fd1ca0c5 (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 'hw/xprint/ps/PsInit.c')
-rw-r--r-- | hw/xprint/ps/PsInit.c | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/hw/xprint/ps/PsInit.c b/hw/xprint/ps/PsInit.c index 639908f73..6c86fa221 100644 --- a/hw/xprint/ps/PsInit.c +++ b/hw/xprint/ps/PsInit.c @@ -97,10 +97,10 @@ static void AllocatePsPrivates(ScreenPtr pScreen); static int PsInitContext(XpContextPtr pCon); static int PsDestroyContext(XpContextPtr pCon); -int PsScreenPrivateIndex; -int PsContextPrivateIndex; -int PsPixmapPrivateIndex; -int PsWindowPrivateIndex; +DevPrivateKey PsScreenPrivateKey = &PsScreenPrivateKey; +DevPrivateKey PsContextPrivateKey = &PsContextPrivateKey; +DevPrivateKey PsPixmapPrivateKey = &PsPixmapPrivateKey; +DevPrivateKey PsWindowPrivateKey = &PsWindowPrivateKey; #ifdef GLXEXT extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); @@ -152,7 +152,8 @@ InitializePsDriver(ndx, pScreen, argc, argv) AllocatePsPrivates(pScreen); #if 0 - pPriv = (PsScreenPrivPtr)pScreen->devPrivates[PsScreenPrivateIndex].ptr; + pPriv = (PsScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey); pPriv->resDB = rmdb; #endif @@ -476,28 +477,12 @@ InitializePsDriver(ndx, pScreen, argc, argv) static void AllocatePsPrivates(ScreenPtr pScreen) { - static unsigned long PsGeneration = 0; + dixRequestPrivate(PsWindowPrivateKey, sizeof(PsWindowPrivRec)); + dixRequestPrivate(PsContextPrivateKey, sizeof(PsContextPrivRec)); + dixRequestPrivate(PsPixmapPrivateKey, sizeof(PsPixmapPrivRec)); - if((unsigned long)PsGeneration != serverGeneration) - { - PsScreenPrivateIndex = AllocateScreenPrivateIndex(); - - PsWindowPrivateIndex = AllocateWindowPrivateIndex(); - AllocateWindowPrivate(pScreen, PsWindowPrivateIndex, - sizeof(PsWindowPrivRec)); - - PsContextPrivateIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate(PsContextPrivateIndex, - sizeof(PsContextPrivRec)); - - PsPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex, - sizeof(PsPixmapPrivRec)); - - PsGeneration = serverGeneration; - } - pScreen->devPrivates[PsScreenPrivateIndex].ptr = - (pointer)xalloc(sizeof(PsScreenPrivRec)); + dixSetPrivate(&pScreen->devPrivates, PsScreenPrivateKey, + xalloc(sizeof(PsScreenPrivRec))); } /* @@ -552,8 +537,8 @@ PsInitContext(pCon) /* * Set up the context privates */ - pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); memset(pConPriv, 0, sizeof(PsContextPrivRec)); pConPriv->jobFileName = (char *)NULL; @@ -622,8 +607,8 @@ static Bool PsDestroyContext(pCon) XpContextPtr pCon; { - PsContextPrivPtr pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + PsContextPrivPtr pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); if( pConPriv->pJobFile!=(FILE *)NULL ) { @@ -655,7 +640,8 @@ PsGetContextFromWindow(win) while( win ) { - pPriv = (PsWindowPrivPtr)win->devPrivates[PsWindowPrivateIndex].ptr; + pPriv = (PsWindowPrivPtr) + dixLookupPrivate(&win->devPrivates, PsWindowPrivateKey); if( pPriv->validContext ) return pPriv->context; win = win->parent; } |