summaryrefslogtreecommitdiff
path: root/src/glx/x11/glx_query.c
diff options
context:
space:
mode:
authorRALOVICH, Kristóf <tade60@freemail.hu>2008-11-03 18:31:22 +0100
committerBrian Paul <brian.paul@tungstengraphics.com>2008-11-26 10:00:58 -0700
commit24b8a8cfe8210ac7bdd661c88523465633151219 (patch)
tree87a4b03c3d89265249662d28811983fbec1fc6ee /src/glx/x11/glx_query.c
parentfd52001c5c292d3b625c164a6c3c357e1da443e0 (diff)
glx: implement __glXGetString, hide __glXGetStringFromServer
Diffstat (limited to 'src/glx/x11/glx_query.c')
-rw-r--r--src/glx/x11/glx_query.c87
1 files changed, 71 insertions, 16 deletions
diff --git a/src/glx/x11/glx_query.c b/src/glx/x11/glx_query.c
index ef33f7c403..2ad2b82313 100644
--- a/src/glx/x11/glx_query.c
+++ b/src/glx/x11/glx_query.c
@@ -37,6 +37,62 @@
# include <xcb/glx.h>
#endif
+#ifdef USE_XCB
+
+/**
+ * Exchange a protocol request for glXQueryServerString.
+ */
+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;
+}
+
+/**
+ * Exchange a protocol request for glGetString.
+ */
+char *
+__glXGetString(Display* dpy,
+ CARD32 contextTag,
+ CARD32 name)
+{
+ xcb_connection_t *c = XGetXCBConnection(dpy);
+ xcb_glx_get_string_reply_t* reply =
+ xcb_glx_get_string_reply(c,
+ xcb_glx_get_string(c,
+ contextTag,
+ 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_get_string_string_length(reply);
+ char* buf = Xmalloc(len);
+ memcpy(buf, xcb_glx_get_string_string(reply), len);
+ free(reply);
+
+ return buf;
+}
+
+#else
+
/**
* GLX protocol structure for the ficticious "GXLGenericGetString" request.
*
@@ -108,27 +164,26 @@ __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);
+ GLXContext gc = __glXGetCurrentContext();
+ return __glXGetStringFromServer(dpy, gc->majorOpcode,
+ X_GLXQueryServerString,
+ screen, name);
+}
- return buf;
+char *
+__glXGetString(Display* dpy,
+ CARD32 contextTag,
+ CARD32 name)
+{
+ GLXContext gc = __glXGetCurrentContext();
+ return __glXGetStringFromServer(dpy, gc->majorOpcode, X_GLsop_GetString,
+ contextTag, name);
}
+
#endif /* USE_XCB */
+