-
-typedef void (* fips_glXSwapBuffers_t)(Display *dpy, GLXDrawable drawable);
-
-static void *
-lookup (const char *name)
-{
- const char *libgl_filename = "libGL.so.1";
- static void *libgl_handle = NULL;
-
- if (! libgl_handle) {
- libgl_handle = dlwrap_real_dlopen (libgl_filename, RTLD_NOW | RTLD_DEEPBIND);
- if (! libgl_handle) {
- fprintf (stderr, "Error: Failed to dlopen %s\n",
- libgl_filename);
- exit (1);
- }
- }
-
- return dlwrap_real_dlsym (libgl_handle, name);
-}
-
-static void
-call_glXSwapBuffers (Display *dpy, GLXDrawable drawable)
-{
- static fips_glXSwapBuffers_t real_glXSwapBuffers = NULL;
- const char *name = "glXSwapBuffers";
-
- if (! real_glXSwapBuffers) {
- real_glXSwapBuffers = (fips_glXSwapBuffers_t) lookup (name);
- if (! real_glXSwapBuffers) {
- fprintf (stderr, "Error: Failed to find function %s.\n",
- name);
- return;
- }
- }
- real_glXSwapBuffers (dpy, drawable);
-}