From 37734ba79ca3a9bad1c1e29d89710c8f9c299210 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Wed, 16 Jun 2010 18:07:04 +0100 Subject: [PATCH] XWin: Fixes for devPrivates API change Fix some typos in devPrivates API changes in XWin code. Move allocation of private keys as it's no longer valid to do them during OsVendorInit() Signed-off-by: Jon TURNEY Reviewed-by: Jamey Sharp Signed-off-by: Keith Packard --- hw/xwin/win.h | 2 +- hw/xwin/winallpriv.c | 20 +++++++++++++++++--- hw/xwin/winglobals.c | 7 ------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 05913d700..8c4b67f17 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -631,7 +631,7 @@ extern int g_fdMessageQueue; extern DevPrivateKeyRec g_iScreenPrivateKeyRec; #define g_iScreenPrivateKey (&g_iScreenPrivateKeyRec) extern DevPrivateKeyRec g_iCmapPrivateKeyRec; -#define g_iCmapPrivateKeyRec (&g_iCmapPrivateKeyRec) +#define g_iCmapPrivateKey (&g_iCmapPrivateKeyRec) extern DevPrivateKeyRec g_iGCPrivateKeyRec; #define g_iGCPrivateKey (&g_iGCPrivateKeyRec) extern DevPrivateKeyRec g_iPixmapPrivateKeyRec; diff --git a/hw/xwin/winallpriv.c b/hw/xwin/winallpriv.c index 6ecbff6d3..ef42d71f4 100644 --- a/hw/xwin/winallpriv.c +++ b/hw/xwin/winallpriv.c @@ -74,25 +74,32 @@ winAllocatePrivates (ScreenPtr pScreen) /* Intialize private structure members */ pScreenPriv->fActive = TRUE; + /* Register our screen private */ + if (!dixRegisterPrivateKey(g_iScreenPrivateKey, PRIVATE_SCREEN, 0)) + { + ErrorF ("winAllocatePrivates - AllocateScreenPrivate () failed\n"); + return FALSE; + } + /* Save the screen private pointer */ winSetScreenPriv (pScreen, pScreenPriv); /* Reserve GC memory for our privates */ - if (!dixRequestPrivateKey(g_iGCPrivateKey, PRIVATE_GC, sizeof (winPrivGCRec))) + if (!dixRegisterPrivateKey(g_iGCPrivateKey, PRIVATE_GC, sizeof (winPrivGCRec))) { ErrorF ("winAllocatePrivates - AllocateGCPrivate () failed\n"); return FALSE; } /* Reserve Pixmap memory for our privates */ - if (!dixRequestPrivateKey(g_iPixmapPrivateKey, PRIVATE_PIXMAP, sizeof (winPrivPixmapRec))) + if (!dixRegisterPrivateKey(g_iPixmapPrivateKey, PRIVATE_PIXMAP, sizeof (winPrivPixmapRec))) { ErrorF ("winAllocatePrivates - AllocatePixmapPrivates () failed\n"); return FALSE; } /* Reserve Window memory for our privates */ - if (!dixRequestPrivateKey(g_iWindowPrivateKey, PRIVATE_WINDOW, sizeof (winPrivWinRec))) + if (!dixRegisterPrivateKey(g_iWindowPrivateKey, PRIVATE_WINDOW, sizeof (winPrivWinRec))) { ErrorF ("winAllocatePrivates () - AllocateWindowPrivates () failed\n"); return FALSE; @@ -161,6 +168,13 @@ winAllocateCmapPrivates (ColormapPtr pCmap) /* Initialize the memory of the private structure */ ZeroMemory (pCmapPriv, sizeof (winPrivCmapRec)); + /* Register our colourmap private */ + if (!dixRegisterPrivateKey(g_iCmapPrivateKey, PRIVATE_COLORMAP, 0)) + { + ErrorF ("winAllocateCmapPrivates - AllocateCmapPrivate () failed\n"); + return FALSE; + } + /* Save the cmap private pointer */ winSetCmapPriv (pCmap, pCmapPriv); diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index 2cc53f2d2..f3f01d7da 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -126,13 +126,6 @@ Atom g_atomLastOwnedSelection = None; void winInitializeGlobals (void) { - if (!dixRegisterPrivateKey(&g_iScreenPrivateKeyRec, PRIVATE_SCREEN, 0) || - !dixRegisterPrivateKey(&g_iCmapPrivateKeyRec, PRIVATE_COLORMAP, 0) || - !dixRegisterPrivateKey(&g_iGCPrivateKeyRec, PRIVATE_GC, 0) || - !dixRegisterPrivateKey(&g_iPixmapPrivateKeyRec, PRIVATE_PIXMAP, 0) || - !dixRegisterPrivateKey(&g_iWindowPrivateKeyRec, PRIVATE_WINDOW, 0)) { - FatalError("cannot register private key"); - } g_dwCurrentThreadID = GetCurrentThreadId (); g_hwndKeyboardFocus = NULL; #ifdef XWIN_CLIPBOARD