X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glxwrap.c;h=799a0190f794de1a63346c372f17b2148835879d;hb=211a9ae3f02ce8032da195b211ea683d5fada05d;hp=6da42e6622abf2a613f373e5db2ef0014c9d80bc;hpb=377222f13763b1b7b78bf558ab9ac8b70535c96d;p=fips diff --git a/glxwrap.c b/glxwrap.c index 6da42e6..799a019 100644 --- a/glxwrap.c +++ b/glxwrap.c @@ -21,6 +21,8 @@ #include "fips.h" +#include "fips-dispatch.h" + #include #include #include @@ -45,24 +47,27 @@ glXSwapBuffers (Display *dpy, GLXDrawable drawable) */ void (*glXGetProcAddressARB (const GLubyte *func))(void) { - void *ptr; - static typeof(&glXGetProcAddressARB) glxwrap_real_glXGetProcAddressARB = NULL; - char *name = "glXGetProcAddressARB"; - - if (! glxwrap_real_glXGetProcAddressARB) { - glxwrap_real_glXGetProcAddressARB = glwrap_lookup (name); - if (! glxwrap_real_glXGetProcAddressARB) { - fprintf (stderr, "Error: Failed to find function %s.\n", - name); - return NULL; - } - } + void *ret; /* If our library has this symbol, that's what we want to give. */ - ptr = dlwrap_real_dlsym (NULL, (const char *) func); - if (ptr) - return ptr; + ret = dlwrap_real_dlsym (NULL, (const char *) func); + if (ret) + return ret; /* Otherwise, just defer to the real glXGetProcAddressARB. */ - return glxwrap_real_glXGetProcAddressARB (func); + GLWRAP_DEFER_WITH_RETURN (ret, glXGetProcAddressARB, func); + + return ret; +} + +Bool +glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx) +{ + Bool ret; + + fips_dispatch_init (FIPS_API_GLX); + + GLWRAP_DEFER_WITH_RETURN (ret, glXMakeCurrent, dpy, drawable, ctx); + + return ret; }