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/xnest | |
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/xnest')
-rw-r--r-- | hw/xnest/GC.c | 2 | ||||
-rw-r--r-- | hw/xnest/Init.c | 2 | ||||
-rw-r--r-- | hw/xnest/Pixmap.c | 8 | ||||
-rw-r--r-- | hw/xnest/Screen.c | 20 | ||||
-rw-r--r-- | hw/xnest/Window.c | 2 | ||||
-rw-r--r-- | hw/xnest/XNGC.h | 6 | ||||
-rw-r--r-- | hw/xnest/XNPixmap.h | 6 | ||||
-rw-r--r-- | hw/xnest/XNWindow.h | 6 |
8 files changed, 20 insertions, 32 deletions
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c index a52ce1f35..06e6e0205 100644 --- a/hw/xnest/GC.c +++ b/hw/xnest/GC.c @@ -35,7 +35,7 @@ is" without express or implied warranty. #include "XNFont.h" #include "Color.h" -int xnestGCPrivateIndex; +DevPrivateKey xnestGCPrivateKey = &xnestGCPrivateKey; static GCFuncs xnestFuncs = { xnestValidateGC, diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c index 5bf0300c6..324cf9696 100644 --- a/hw/xnest/Init.c +++ b/hw/xnest/Init.c @@ -74,8 +74,6 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) break; } - xnestWindowPrivateIndex = AllocateWindowPrivateIndex(); - xnestGCPrivateIndex = AllocateGCPrivateIndex(); xnestFontPrivateIndex = AllocateFontPrivateIndex(); if (!xnestNumScreens) xnestNumScreens = 1; diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c index c4b8aa65e..c9c662af3 100644 --- a/hw/xnest/Pixmap.c +++ b/hw/xnest/Pixmap.c @@ -33,7 +33,7 @@ is" without express or implied warranty. #include "Screen.h" #include "XNPixmap.h" -int xnestPixmapPrivateIndex; +DevPrivateKey xnestPixmapPrivateKey = &xnestPixmapPrivateKey; PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth) @@ -56,8 +56,8 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth) pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->refcnt = 1; pPixmap->devKind = PixmapBytePad(width, depth); - pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr = - (pointer)((char *)pPixmap + pScreen->totalPixmapSize); + dixSetPrivate(&pPixmap->devPrivates, xnestPixmapPrivateKey, + (char *)pPixmap + pScreen->totalPixmapSize); if (width && height) xnestPixmapPriv(pPixmap)->pixmap = XCreatePixmap(xnestDisplay, @@ -75,7 +75,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap) if(--pPixmap->refcnt) return TRUE; XFreePixmap(xnestDisplay, xnestPixmap(pPixmap)); - dixFreePrivates(*DEVPRIV_PTR(pPixmap)); + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index d08e48245..f91454928 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -49,8 +49,6 @@ Window xnestScreenSaverWindows[MAXSCREENS]; extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #endif -static int xnestScreenGeneration = -1; - ScreenPtr xnestScreen(Window window) { @@ -146,21 +144,13 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) VisualID defaultVisual; int rootDepth; - if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex, - sizeof(xnestPrivWin)) && - AllocateGCPrivate(pScreen, xnestGCPrivateIndex, - sizeof(xnestPrivGC)))) + if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin))) + return False; + if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC))) return False; - - if (xnestScreenGeneration != serverGeneration) { - if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0) - return False; - xnestScreenGeneration = serverGeneration; - } - - if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex, - sizeof (xnestPrivPixmap))) + if (!dixRequestPrivate(xnestPixmapPrivateKey, sizeof (xnestPrivPixmap))) return False; + visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec)); numVisuals = 0; diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c index f87a1baa7..0955e61b9 100644 --- a/hw/xnest/Window.c +++ b/hw/xnest/Window.c @@ -39,7 +39,7 @@ is" without express or implied warranty. #include "Events.h" #include "Args.h" -int xnestWindowPrivateIndex; +DevPrivateKey xnestWindowPrivateKey = &xnestWindowPrivateKey; static int xnestFindWindowMatch(WindowPtr pWin, pointer ptr) diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h index d3ac3df0b..19535fe3a 100644 --- a/hw/xnest/XNGC.h +++ b/hw/xnest/XNGC.h @@ -22,10 +22,10 @@ typedef struct { int nClipRects; } xnestPrivGC; -extern int xnestGCPrivateIndex; +extern DevPrivateKey xnestGCPrivateKey; -#define xnestGCPriv(pGC) \ - ((xnestPrivGC *)((pGC)->devPrivates[xnestGCPrivateIndex].ptr)) +#define xnestGCPriv(pGC) ((xnestPrivGC *) \ + dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey)) #define xnestGC(pGC) (xnestGCPriv(pGC)->gc) diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h index 6971b1162..3b0833993 100644 --- a/hw/xnest/XNPixmap.h +++ b/hw/xnest/XNPixmap.h @@ -15,14 +15,14 @@ is" without express or implied warranty. #ifndef XNESTPIXMAP_H #define XNESTPIXMAP_H -extern int xnestPixmapPrivateIndex; +extern DevPrivateKey xnestPixmapPrivateKey; typedef struct { Pixmap pixmap; } xnestPrivPixmap; -#define xnestPixmapPriv(pPixmap) \ - ((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr)) +#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \ + dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey)) #define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap) diff --git a/hw/xnest/XNWindow.h b/hw/xnest/XNWindow.h index 21be5f5e3..1aaf4e153 100644 --- a/hw/xnest/XNWindow.h +++ b/hw/xnest/XNWindow.h @@ -35,10 +35,10 @@ typedef struct { Window window; } xnestWindowMatch; -extern int xnestWindowPrivateIndex; +extern DevPrivateKey xnestWindowPrivateKey; -#define xnestWindowPriv(pWin) \ - ((xnestPrivWin *)((pWin)->devPrivates[xnestWindowPrivateIndex].ptr)) +#define xnestWindowPriv(pWin) ((xnestPrivWin *) \ + dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey)) #define xnestWindow(pWin) (xnestWindowPriv(pWin)->window) |