From 2e8069dd36c2f5caf868937405fc03328004a85d Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sun, 11 Jul 2010 20:35:43 -0700 Subject: [PATCH] xnest: Replace use of Colormap->devPriv with standard devPrivates. Signed-off-by: Jamey Sharp Reviewed-by: Tiago Vignatti --- hw/xnest/Color.c | 5 ++--- hw/xnest/Color.h | 3 ++- hw/xnest/Screen.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index 883b77cb2..0aae8e9c9 100644 --- a/hw/xnest/Color.c +++ b/hw/xnest/Color.c @@ -34,6 +34,8 @@ is" without express or implied warranty. #include "XNWindow.h" #include "Args.h" +DevPrivateKeyRec xnestColormapPrivateKeyRec; + static DevPrivateKeyRec cmapScrPrivateKeyRec; #define cmapScrPrivateKey (&cmapScrPrivateKeyRec) @@ -52,8 +54,6 @@ xnestCreateColormap(ColormapPtr pCmap) pVisual = pCmap->pVisual; ncolors = pVisual->ColormapEntries; - pCmap->devPriv = (pointer)malloc(sizeof(xnestPrivColormap)); - xnestColormapPriv(pCmap)->colormap = XCreateColormap(xnestDisplay, xnestDefaultWindows[pCmap->pScreen->myNum], @@ -130,7 +130,6 @@ void xnestDestroyColormap(ColormapPtr pCmap) { XFreeColormap(xnestDisplay, xnestColormap(pCmap)); - free(pCmap->devPriv); } #define SEARCH_PREDICATE \ diff --git a/hw/xnest/Color.h b/hw/xnest/Color.h index f00bde47f..d39c638f9 100644 --- a/hw/xnest/Color.h +++ b/hw/xnest/Color.h @@ -32,8 +32,9 @@ typedef struct { int index; } xnestInstalledColormapWindows; +extern DevPrivateKeyRec xnestColormapPrivateKeyRec; #define xnestColormapPriv(pCmap) \ - ((xnestPrivColormap *)((pCmap)->devPriv)) + ((xnestPrivColormap *) dixLookupPrivate(&(pCmap)->devPrivates, &xnestColormapPrivateKeyRec)) #define xnestColormap(pCmap) (xnestColormapPriv(pCmap)->colormap) diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index 957fe4cdb..0a6cab687 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -151,6 +151,8 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) return FALSE; if (!dixRegisterPrivateKey(&xnestPixmapPrivateKeyRec, PRIVATE_PIXMAP, sizeof (xnestPrivPixmap))) return FALSE; + if (!dixRegisterPrivateKey(&xnestColormapPrivateKeyRec, PRIVATE_COLORMAP, sizeof (xnestPrivColormap))) + return FALSE; if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0)) return FALSE;