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 /cfb | |
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 'cfb')
-rw-r--r-- | cfb/cfb.h | 14 | ||||
-rw-r--r-- | cfb/cfballpriv.c | 41 | ||||
-rw-r--r-- | cfb/cfbpixmap.c | 2 | ||||
-rw-r--r-- | cfb/cfbrrop.h | 3 | ||||
-rw-r--r-- | cfb/cfbscrinit.c | 20 | ||||
-rw-r--r-- | cfb/cfbwindow.c | 6 |
6 files changed, 40 insertions, 46 deletions
@@ -56,8 +56,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. pixmap.devKind = width_of_pixmap_in_bytes */ -extern int cfbGCPrivateIndex; -extern int cfbWindowPrivateIndex; +extern DevPrivateKey cfbGCPrivateKey; +extern DevPrivateKey cfbWindowPrivateKey; /* private field of GC */ typedef struct { @@ -72,7 +72,7 @@ typedef struct { typedef cfbPrivGC *cfbPrivGCPtr; #define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\ - (pGC)->devPrivates[cfbGCPrivateIndex].ptr) + dixLookupPrivate(&(pGC)->devPrivates, cfbGCPrivateKey)) #define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip) @@ -93,7 +93,7 @@ typedef struct { } cfbPrivWin; #define cfbGetWindowPrivate(_pWin) ((cfbPrivWin *)\ - (_pWin)->devPrivates[cfbWindowPrivateIndex].ptr) + dixLookupPrivate(&(_pWin)->devPrivates, cfbWindowPrivateKey)) /* cfb8bit.c */ @@ -314,8 +314,8 @@ extern int cfb8SegmentSS1RectXor( extern Bool cfbAllocatePrivates( ScreenPtr /*pScreen*/, - int * /*window_index*/, - int * /*gc_index*/ + DevPrivateKey * /*window_key*/, + DevPrivateKey * /*gc_key*/ ); /* cfbbitblt.c */ @@ -1230,7 +1230,7 @@ extern void cfbZeroPolyArcSS8Xor( #define CFB_NEED_SCREEN_PRIVATE -extern int cfbScreenPrivateIndex; +extern DevPrivateKey cfbScreenPrivateKey; #endif #ifndef CFB_PROTOTYPES_ONLY diff --git a/cfb/cfballpriv.c b/cfb/cfballpriv.c index e0ccdf4d0..e6ab93a87 100644 --- a/cfb/cfballpriv.c +++ b/cfb/cfballpriv.c @@ -45,48 +45,37 @@ in this Software without prior written authorization from The Open Group. #include "mibstore.h" #if 1 || PSZ==8 -int cfbWindowPrivateIndex = -1; -int cfbGCPrivateIndex = -1; +DevPrivateKey cfbWindowPrivateKey = &cfbWindowPrivateKey; +DevPrivateKey cfbGCPrivateKey = &cfbGCPrivateKey; #endif #ifdef CFB_NEED_SCREEN_PRIVATE -int cfbScreenPrivateIndex = -1; -static unsigned long cfbGeneration = 0; +DevPrivateKey cfbScreenPrivateKey = &cfbScreenPrivateKey; #endif Bool -cfbAllocatePrivates(pScreen, window_index, gc_index) +cfbAllocatePrivates(pScreen, window_key, gc_key) ScreenPtr pScreen; - int *window_index, *gc_index; + DevPrivateKey *window_key, *gc_key; { - if (!window_index || !gc_index || - (*window_index == -1 && *gc_index == -1)) + if (!window_key || !gc_key || (!*window_key && !*gc_key)) { if (!mfbAllocatePrivates(pScreen, - &cfbWindowPrivateIndex, &cfbGCPrivateIndex)) + &cfbWindowPrivateKey, &cfbGCPrivateKey)) return FALSE; - if (window_index) - *window_index = cfbWindowPrivateIndex; - if (gc_index) - *gc_index = cfbGCPrivateIndex; + if (window_key) + *window_key = cfbWindowPrivateKey; + if (gc_key) + *gc_key = cfbGCPrivateKey; } else { - cfbWindowPrivateIndex = *window_index; - cfbGCPrivateIndex = *gc_index; + cfbWindowPrivateKey = *window_key; + cfbGCPrivateKey = *gc_key; } - if (!AllocateWindowPrivate(pScreen, cfbWindowPrivateIndex, - sizeof(cfbPrivWin)) || - !AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) + if (!dixRequestPrivate(cfbWindowPrivateKey, sizeof(cfbPrivWin))) return FALSE; -#ifdef CFB_NEED_SCREEN_PRIVATE - if (cfbGeneration != serverGeneration) - { - cfbScreenPrivateIndex = AllocateScreenPrivateIndex (); - cfbGeneration = serverGeneration; - } - if (cfbScreenPrivateIndex == -1) + if (!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC))) return FALSE; -#endif return TRUE; } diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c index ed01316ed..247331c6d 100644 --- a/cfb/cfbpixmap.c +++ b/cfb/cfbpixmap.c @@ -107,7 +107,7 @@ cfbDestroyPixmap(pPixmap) { if(--pPixmap->refcnt) return TRUE; - dixFreePrivates(*DEVPRIV_PTR(pPixmap)); + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h index eeb373a5e..e9ca881be 100644 --- a/cfb/cfbrrop.h +++ b/cfb/cfbrrop.h @@ -35,7 +35,8 @@ in this Software without prior written authorization from The Open Group. #endif #define RROP_FETCH_GC(gc) \ - RROP_FETCH_GCPRIV(((cfbPrivGCPtr)(gc)->devPrivates[cfbGCPrivateIndex].ptr)) + RROP_FETCH_GCPRIV((cfbPrivGCPtr)dixLookupPrivate(&(gc)->devPrivates, \ + cfbGCPrivateKey)) #ifndef RROP #define RROP GXset diff --git a/cfb/cfbscrinit.c b/cfb/cfbscrinit.c index 83f5cf0a2..48e363971 100644 --- a/cfb/cfbscrinit.c +++ b/cfb/cfbscrinit.c @@ -59,7 +59,7 @@ cfbCloseScreen (index, pScreen) xfree (depths); xfree (pScreen->visuals); #ifdef CFB_NEED_SCREEN_PRIVATE - xfree (pScreen->devPrivates[cfbScreenPrivateIndex].ptr); + xfree (dixLookupPrivate(&pScreen->devPrivates, cfbScreenPrivateKey)); #else xfree (pScreen->devPrivate); #endif @@ -88,7 +88,7 @@ cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width) int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { - if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0)) + if (!cfbAllocatePrivates(pScreen, NULL, NULL)) return FALSE; pScreen->defColormap = FakeClientID(0); /* let CreateDefColormap do whatever it wants for pixels */ @@ -132,9 +132,11 @@ cfbCreateScreenResources(pScreen) Bool retval; pointer oldDevPrivate = pScreen->devPrivate; - pScreen->devPrivate = pScreen->devPrivates[cfbScreenPrivateIndex].ptr; + pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates, + cfbScreenPrivateKey); retval = miCreateScreenResources(pScreen); - pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; + dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey, + pScreen->devPrivate); pScreen->devPrivate = oldDevPrivate; return retval; } @@ -173,7 +175,8 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) pScreen->CloseScreen = cfbCloseScreen; #ifdef CFB_NEED_SCREEN_PRIVATE pScreen->CreateScreenResources = cfbCreateScreenResources; - pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; + dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey, + pScreen->devPrivate); pScreen->devPrivate = oldDevPrivate; #endif pScreen->GetScreenPixmap = cfbGetScreenPixmap; @@ -200,7 +203,8 @@ cfbGetScreenPixmap(pScreen) ScreenPtr pScreen; { #ifdef CFB_NEED_SCREEN_PRIVATE - return (PixmapPtr)pScreen->devPrivates[cfbScreenPrivateIndex].ptr; + return (PixmapPtr)dixLookupPrivate(&pScreen->devPrivates, + cfbScreenPrivateKey); #else return (PixmapPtr)pScreen->devPrivate; #endif @@ -212,8 +216,8 @@ cfbSetScreenPixmap(pPix) { #ifdef CFB_NEED_SCREEN_PRIVATE if (pPix) - pPix->drawable.pScreen->devPrivates[cfbScreenPrivateIndex].ptr = - (pointer)pPix; + dixSetPrivate(&pPix->drawable.pScreen->devPrivates, + cfbScreenPrivateKey, pPix); #else if (pPix) pPix->drawable.pScreen->devPrivate = (pointer)pPix; diff --git a/cfb/cfbwindow.c b/cfb/cfbwindow.c index e04b73df2..49cc6f079 100644 --- a/cfb/cfbwindow.c +++ b/cfb/cfbwindow.c @@ -75,8 +75,8 @@ cfbCreateWindow(pWin) #ifdef PIXMAP_PER_WINDOW /* Setup pointer to Screen pixmap */ - pWin->devPrivates[frameWindowPrivateIndex].ptr = - (pointer) cfbGetScreenPixmap(pWin->drawable.pScreen); + dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, + cfbGetScreenPixmap(pWin->drawable.pScreen)); #endif return TRUE; @@ -213,7 +213,7 @@ cfbCopyWindow(pWin, ptOldOrg, prgnSrc) /* swap in correct PaintWindow* routine. If we can use a fast output routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy -of it in devPrivates[cfbWindowPrivateIndex].ptr. +of it in devPrivates under cfbWindowPrivateKey. */ Bool cfbChangeWindowAttributes(pWin, mask) |