---
 src/glx/x11/glx_query.c |   31 +++++++++++++++++++++++++++++++
 src/glx/x11/glxclient.h |    4 ++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c
index 9664243..9e52990 100644
--- a/src/glx/x11/glx_query.c
+++ b/src/glx/x11/glx_query.c
@@ -32,6 +32,12 @@
 
 #include "glxclient.h"
 
+#if defined(USE_XCB)
+# include <X11/Xlib-xcb.h>
+# include <xcb/xcb.h>
+# include <xcb/glx.h>
+#endif
+
 /**
  * GLX protocol structure for the ficticious "GXLGenericGetString" request.
  * 
@@ -102,3 +108,28 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 
glxCode,
 
    return buf;
 }
+
+#ifdef USE_XCB
+char *
+__glXQueryServerString(Display* dpy,
+                       CARD32 screen,
+                       CARD32 name)
+{
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_query_server_string_reply_t* reply =
+      xcb_glx_query_server_string_reply(c,
+                                        xcb_glx_query_server_string(c,
+                                                                    screen,
+                                                                    name),
+                                        NULL);
+
+   /* The spec doesn't mention this, but the Xorg server replies with
+    * a string already terminated with '\0'. */
+   uint32_t len = xcb_glx_query_server_string_string_length(reply);
+   char* buf = Xmalloc(len);
+   memcpy(buf, xcb_glx_query_server_string_string(reply), len);
+   free(reply);
+
+   return buf;
+}
+#endif /* USE_XCB */
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index fe2f540..4daab0e 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -743,6 +743,10 @@ extern void __glXInitializeVisualConfigFromTags( 
__GLcontextModes *config,
 extern char * __glXGetStringFromServer( Display * dpy, int opcode,
     CARD32 glxCode, CARD32 for_whom, CARD32 name );
 
+#ifdef USE_XCB
+extern char * __glXQueryServerString(Display* dpy, CARD32 screen, CARD32 name);
+#endif
+
 extern char *__glXstrdup(const char *str);
 
 
-- 
1.6.0.2


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to