summaryrefslogtreecommitdiff
path: root/GL/glx/single2.c
diff options
context:
space:
mode:
Diffstat (limited to 'GL/glx/single2.c')
-rw-r--r--GL/glx/single2.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/GL/glx/single2.c b/GL/glx/single2.c
index 286f63d70..c542d60f4 100644
--- a/GL/glx/single2.c
+++ b/GL/glx/single2.c
@@ -296,16 +296,25 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
return combo_string;
}
-int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
+int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
{
ClientPtr client;
__GLXcontext *cx;
GLenum name;
const char *string;
+ __GLX_DECLARE_SWAP_VARIABLES;
int error;
char *buf = NULL, *buf1 = NULL;
GLint length = 0;
+ /* If the client has the opposite byte order, swap the contextTag and
+ * the name.
+ */
+ if ( need_swap ) {
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + __GLX_SINGLE_HDR_SIZE);
+ }
+
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error);
if (!cx) {
return error;
@@ -331,12 +340,32 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
}
string = buf;
}
+ else if ( name == GL_VERSION ) {
+ if ( xf86atof( string ) > xf86atof( GLServerVersion ) ) {
+ buf = __glXMalloc( __glXStrlen( string )
+ + __glXStrlen( GLServerVersion )
+ + 4 );
+ if ( buf == NULL ) {
+ string = GLServerVersion;
+ }
+ else {
+ __glXSprintf( buf, "%s (%s)", GLServerVersion, string );
+ string = buf;
+ }
+ }
+ }
if (string) {
length = __glXStrlen((const char *) string) + 1;
}
__GLX_BEGIN_REPLY(length);
__GLX_PUT_SIZE(length);
+
+ if ( need_swap ) {
+ __GLX_SWAP_REPLY_SIZE();
+ __GLX_SWAP_REPLY_HEADER();
+ }
+
__GLX_SEND_HEADER();
WriteToClient(client, length, (char *) string);
if (buf != NULL) {
@@ -345,6 +374,11 @@ int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
return Success;
}
+int __glXDisp_GetString(__GLXclientState *cl, GLbyte *pc)
+{
+ return DoGetString(cl, pc, GL_FALSE);
+}
+
int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc)
{
__GLXcontext *cx;