summaryrefslogtreecommitdiff
path: root/src/glx/x11/glx_query.c
diff options
context:
space:
mode:
authorRALOVICH, Kristóf <tade60@freemail.hu>2008-10-18 16:53:08 +0200
committerBrian Paul <brian.paul@tungstengraphics.com>2008-11-26 10:00:58 -0700
commit5444424562781a0a40559db40dfe9b97286dc9da (patch)
tree34571320cbc98656010144464dfe57dccf6a21a9 /src/glx/x11/glx_query.c
parent55aeeef5476528907f12ba42d6157dc1b016cadf (diff)
glx: implement __glXQueryServerString using XCB
Diffstat (limited to 'src/glx/x11/glx_query.c')
-rw-r--r--src/glx/x11/glx_query.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c
index 56f3495186..ef33f7c403 100644
--- a/src/glx/x11/glx_query.c
+++ b/src/glx/x11/glx_query.c
@@ -31,6 +31,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.
*
@@ -101,3 +107,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 */