From 001de0ac4e9ccd5c440dca4a2994deca668a2d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 6 Nov 2007 13:32:04 -0500 Subject: [PATCH] Remove a couple of "deprecated" fields from __GLXcontextRec. The __GLXcontextRec struct is internal to the libGL implementation. No point in "deprecating", just get rid of it. --- src/glx/x11/glcontextmodes.c | 25 +++++++++++++++++-------- src/glx/x11/glcontextmodes.h | 6 ++++-- src/glx/x11/glxclient.h | 21 --------------------- src/glx/x11/glxcmds.c | 14 +++++++------- 4 files changed, 28 insertions(+), 38 deletions(-) diff --git a/src/glx/x11/glcontextmodes.c b/src/glx/x11/glcontextmodes.c index c1651849031..79bdce79989 100644 --- a/src/glx/x11/glcontextmodes.c +++ b/src/glx/x11/glcontextmodes.c @@ -453,19 +453,28 @@ _gl_context_modes_destroy( __GLcontextModes * modes ) */ __GLcontextModes * -_gl_context_modes_find_visual( __GLcontextModes * modes, int vid ) +_gl_context_modes_find_visual(__GLcontextModes *modes, int vid) { - while ( modes != NULL ) { - if ( modes->visualID == vid ) { - break; - } + __GLcontextModes *m; - modes = modes->next; - } + for (m = modes; m != NULL; m = m->next) + if (m->visualID == vid) + return m; - return modes; + return NULL; } +__GLcontextModes * +_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid) +{ + __GLcontextModes *m; + + for (m = modes; m != NULL; m = m->next) + if (m->fbconfigID == fbid) + return m; + + return NULL; +} /** * Determine if two context-modes are the same. This is intended to be used diff --git a/src/glx/x11/glcontextmodes.h b/src/glx/x11/glcontextmodes.h index 4b5c6f68b8f..afd09cd7fbd 100644 --- a/src/glx/x11/glcontextmodes.h +++ b/src/glx/x11/glcontextmodes.h @@ -44,8 +44,10 @@ extern int _gl_get_context_mode_data( const __GLcontextModes *mode, extern __GLcontextModes * _gl_context_modes_create( unsigned count, size_t minimum_size ); extern void _gl_context_modes_destroy( __GLcontextModes * modes ); -extern __GLcontextModes * _gl_context_modes_find_visual( - __GLcontextModes * modes, int vid ); +extern __GLcontextModes * + _gl_context_modes_find_visual(__GLcontextModes *modes, int vid); +extern __GLcontextModes * + _gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid); extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a, const __GLcontextModes * b ); diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index b464e505fc5..b5951bd62a1 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -232,15 +232,6 @@ struct __GLXcontextRec { */ XID share_xid; - /** - * Visual id. - * - * \deprecated - * This filed has been largely been replaced by the \c mode field, but - * the work is not quite done. - */ - VisualID vid; - /** * Screen number. */ @@ -367,18 +358,6 @@ struct __GLXcontextRec { */ XID hwContextID; #endif - - /** - * \c GLXFBConfigID used to create this context. May be \c None. This - * field has been replaced by the \c mode field. - * - * \since Internal API version 20030317. - * - * \deprecated - * This filed has been largely been replaced by the \c mode field, but - * the work is not quite done. - */ - GLXFBConfigID fbconfigID; /** * The current read-drawable for this context. Will be None if this diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 80d46f6b23e..848ba3bba1d 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -420,8 +420,6 @@ CreateContext(Display *dpy, XVisualInfo *vis, gc->isDirect = GL_TRUE; gc->screen = mode->screen; gc->psc = psc; - gc->vid = mode->visualID; - gc->fbconfigID = mode->fbconfigID; gc->mode = mode; } else { @@ -1515,13 +1513,15 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx) ctx->share_xid = *pProp++; break; case GLX_VISUAL_ID_EXT: - ctx->vid = *pProp++; + ctx->mode = + _gl_context_modes_find_visual(ctx->psc->visuals, *pProp++); break; case GLX_SCREEN: ctx->screen = *pProp++; break; case GLX_FBCONFIG_ID: - ctx->fbconfigID = *pProp++; + ctx->mode = + _gl_context_modes_find_fbconfig(ctx->psc->configs, *pProp++); break; case GLX_RENDER_TYPE: ctx->renderType = *pProp++; @@ -1546,7 +1546,7 @@ glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value) int retVal; /* get the information from the server if we don't have it already */ - if (!ctx->isDirect && (ctx->vid == None)) { + if (!ctx->isDirect && (ctx->mode == NULL)) { retVal = __glXQueryContextInfo(dpy, ctx); if (Success != retVal) return retVal; } @@ -1555,13 +1555,13 @@ glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value) *value = (int)(ctx->share_xid); break; case GLX_VISUAL_ID_EXT: - *value = (int)(ctx->vid); + *value = ctx->mode ? ctx->mode->visualID : None; break; case GLX_SCREEN: *value = (int)(ctx->screen); break; case GLX_FBCONFIG_ID: - *value = (int)(ctx->fbconfigID); + *value = ctx->mode ? ctx->mode->fbconfigID : None; break; case GLX_RENDER_TYPE: *value = (int)(ctx->renderType);