Import wine_tsx11_lock/unlock directly from x11drv in opengl32 and
ddraw, so that they don't need to link with libwine_tsx11.
Removed header wine_gl.h.

diff --git a/dlls/opengl32/Makefile.in b/dlls/opengl32/Makefile.in
index f280b08..9cc0b4a 100644
--- a/dlls/opengl32/Makefile.in
+++ b/dlls/opengl32/Makefile.in
@@ -4,7 +4,7 @@
 VPATH     = @srcdir@
 MODULE    = opengl32.dll
 IMPORTS   = user32 gdi32 kernel32
-EXTRALIBS = $(LIBTSX11) $(X_LIBS) $(XLIB)
+EXTRALIBS = $(X_LIBS) $(XLIB)
 
 LDDLLFLAGS = @LDDLLFLAGS@
 SYMBOLFILE = $(MODULE).tmp.o
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl
index 268c587..990e9c0 100755
--- a/dlls/opengl32/make_opengl
+++ b/dlls/opengl32/make_opengl
@@ -544,7 +544,7 @@
 /* Auto-generated file... Do not edit ! */
 
 #include \"config.h\"
-#include \"wine_gl.h\"
+#include \"opengl_ext.h\"
 #include \"wine/debug.h\"
 
 typedef const GLubyte * GLstring;
@@ -567,13 +567,11 @@
 /* Auto-generated file... Do not edit ! */
 
 #include \"config.h\"
-#include \"wine_gl.h\"
+#include \"opengl_ext.h\"
 #include \"wine/debug.h\"
 
 typedef const GLubyte * GLstring;
 
-#include \"opengl_ext.h\"
-
 WINE_DEFAULT_DEBUG_CHANNEL(opengl);
 
 ";
diff --git a/dlls/opengl32/opengl_ext.c b/dlls/opengl32/opengl_ext.c
index 30ec036..8720e89 100644
--- a/dlls/opengl32/opengl_ext.c
+++ b/dlls/opengl32/opengl_ext.c
@@ -2,13 +2,11 @@
 /* Auto-generated file... Do not edit ! */
 
 #include "config.h"
-#include "wine_gl.h"
+#include "opengl_ext.h"
 #include "wine/debug.h"
 
 typedef const GLubyte * GLstring;
 
-#include "opengl_ext.h"
-
 WINE_DEFAULT_DEBUG_CHANNEL(opengl);
 
 void (*func_glActiveTexture)( GLenum ) = (void *) 0xdeadbeef;
diff --git a/dlls/opengl32/opengl_ext.h b/dlls/opengl32/opengl_ext.h
index e0f3d4d..32e81a2 100644
--- a/dlls/opengl32/opengl_ext.h
+++ b/dlls/opengl32/opengl_ext.h
@@ -19,6 +19,37 @@
 #ifndef __DLLS_OPENGL32_OPENGL_EXT_H
 #define __DLLS_OPENGL32_OPENGL_EXT_H
 
+#undef APIENTRY
+#undef CALLBACK
+#undef WINAPI
+
+#define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
+#include <GL/gl.h>
+#include <GL/glx.h>
+#ifdef HAVE_GL_GLEXT_H
+# include <GL/glext.h>
+#endif
+#undef  XMD_H
+
+#undef APIENTRY
+#undef CALLBACK
+#undef WINAPI
+
+/* Redefines the constants */
+#define CALLBACK    __stdcall
+#define WINAPI      __stdcall
+#define APIENTRY    WINAPI
+
+/* X11 locking */
+
+extern void (*wine_tsx11_lock_ptr)(void);
+extern void (*wine_tsx11_unlock_ptr)(void);
+
+/* As GLX relies on X, this is needed */
+#define ENTER_GL() wine_tsx11_lock_ptr()
+#define LEAVE_GL() wine_tsx11_unlock_ptr()
+
+
 typedef struct {
   char  *name;     /* name of the extension */
   char  *glx_name; /* name used on Unix's libGL */
diff --git a/dlls/opengl32/opengl_norm.c b/dlls/opengl32/opengl_norm.c
index 92e9cad..62dda47 100644
--- a/dlls/opengl32/opengl_norm.c
+++ b/dlls/opengl32/opengl_norm.c
@@ -2,7 +2,7 @@
 /* Auto-generated file... Do not edit ! */
 
 #include "config.h"
-#include "wine_gl.h"
+#include "opengl_ext.h"
 #include "wine/debug.h"
 
 typedef const GLubyte * GLstring;
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 94efd66..c092d6c 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -26,7 +26,6 @@
 #include "winbase.h"
 #include "winuser.h"
 #include "winerror.h"
-#include "wine_gl.h"
 #include "x11drv.h"
 
 #include "wgl.h"
@@ -35,6 +34,9 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(opengl);
 
+void (*wine_tsx11_lock_ptr)(void) = NULL;
+void (*wine_tsx11_unlock_ptr)(void) = NULL;
+
 static GLXContext default_cx = NULL;
 static Display *default_display;  /* display to use for default context */
 
@@ -586,13 +588,17 @@
   HDC hdc;
   XVisualInfo *vis = NULL;
   Window root = (Window)GetPropA( GetDesktopWindow(), "__wine_x11_whole_window" );
+  HMODULE mod = GetModuleHandleA( "x11drv.dll" );
 
-  if (!root)
+  if (!root || !mod)
   {
       ERR("X11DRV not loaded. Cannot create default context.\n");
       return FALSE;
   }
 
+  wine_tsx11_lock_ptr   = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
+  wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
+
   hdc = GetDC(0);
   default_display = get_display( hdc );
   ReleaseDC( 0, hdc );