diff options
Diffstat (limited to 'GL')
-rw-r--r-- | GL/glx/glxext.c | 9 | ||||
-rw-r--r-- | GL/glx/glxscreens.c | 20 |
2 files changed, 9 insertions, 20 deletions
diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index 4d6bfd7c6..55463c7cf 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -27,6 +27,7 @@ #include "glxserver.h" #include <windowstr.h> #include <propertyst.h> +#include "privates.h" #include <os.h> #include "g_disptab.h" #include "unpack.h" @@ -53,7 +54,7 @@ RESTYPE __glXSwapBarrierRes; */ xGLXSingleReply __glXReply; -static int glxClientPrivateIndex; +static DevPrivateKey glxClientPrivateKey = &glxClientPrivateKey; /* ** Client that called into GLX dispatch. @@ -218,7 +219,7 @@ int __glXError(int error) __GLXclientState * glxGetClient(ClientPtr pClient) { - return (__GLXclientState *) pClient->devPrivates[glxClientPrivateIndex].ptr; + return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey); } static void @@ -288,9 +289,7 @@ void GlxExtensionInit(void) __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone); - glxClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (glxClientPrivateIndex, - sizeof (__GLXclientState))) + if (!dixRequestPrivate(glxClientPrivateKey, sizeof (__GLXclientState))) return; if (!AddCallback (&ClientStateCallback, glxClientCallback, 0)) return; diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index c6f060b3d..6e4d497f5 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -41,11 +41,12 @@ #include <windowstr.h> #include <os.h> +#include "privates.h" #include "glxserver.h" #include "glxutil.h" #include "glxext.h" -static int glxScreenPrivateIndex; +static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey; const char GLServerVersion[] = "1.4"; static const char GLServerExtensions[] = @@ -278,22 +279,11 @@ glxCloseScreen (int index, ScreenPtr pScreen) __GLXscreen * glxGetScreen(ScreenPtr pScreen) { - return (__GLXscreen *) pScreen->devPrivates[glxScreenPrivateIndex].ptr; + return dixLookupPrivate(&pScreen->devPrivates, glxScreenPrivateKey); } void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen) { - static int glxGeneration; - - if (glxGeneration != serverGeneration) - { - glxScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (glxScreenPrivateIndex == -1) - return; - - glxGeneration = serverGeneration; - } - glxScreen->pScreen = pScreen; glxScreen->GLextensions = xstrdup(GLServerExtensions); glxScreen->GLXvendor = xstrdup(GLXServerVendorName); @@ -308,9 +298,9 @@ void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen) __glXScreenInitVisuals(glxScreen); - pScreen->devPrivates[glxScreenPrivateIndex].ptr = (pointer) glxScreen; + dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, glxScreen); } - + void __glXScreenDestroy(__GLXscreen *screen) { xfree(screen->GLXvendor); |