diff options
Diffstat (limited to 'GL/glx/single2swap.c')
-rw-r--r-- | GL/glx/single2swap.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/GL/glx/single2swap.c b/GL/glx/single2swap.c index c8c496871..96db415f9 100644 --- a/GL/glx/single2swap.c +++ b/GL/glx/single2swap.c @@ -262,7 +262,58 @@ int __glXDispSwap_Finish(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetString(__GLXclientState *cl, GLbyte *pc) { - return DoGetString(cl, pc, GL_TRUE); + ClientPtr client; + __GLXcontext *cx; + GLenum name; + const char *string; + __GLX_DECLARE_SWAP_VARIABLES; + int error; + char *buf = NULL, *buf1 = NULL; + GLint length = 0; + + __GLX_SWAP_INT(&((xGLXSingleReq *)pc)->contextTag); + cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); + if (!cx) { + return error; + } + + pc += __GLX_SINGLE_HDR_SIZE; + __GLX_SWAP_INT(pc + 0); + name = *(GLenum *)(pc + 0); + string = (const char *)glGetString(name); + client = cl->client; + + /* + ** Restrict extensions to those that are supported by both the + ** implementation and the connection. That is, return the + ** intersection of client, server, and core extension strings. + */ + if (name == GL_EXTENSIONS) { + buf1 = __glXcombine_strings(string, + cl->GLClientextensions); + buf = __glXcombine_strings(buf1, + cx->pGlxScreen->GLextensions); + if (buf1 != NULL) { + __glXFree(buf1); + } + string = buf; + } + if (string) { + length = __glXStrlen((const char *) string) + 1; + } + + __GLX_BEGIN_REPLY(length); + __GLX_PUT_SIZE(length); + + __GLX_SWAP_REPLY_SIZE(); + __GLX_SWAP_REPLY_HEADER(); + __GLX_SEND_HEADER(); + WriteToClient(client, length, (char *) string); + if (buf != NULL) { + __glXFree(buf); + } + + return Success; } int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) |