Fix a number of MINGW32 issues
[mesa.git] / include / GL / glut.h
index 7977dc94c92a08fe5517260866cdc8aa025432b3..e286349f9b01c3903b4f9104c9aaf36ba1531661 100644 (file)
 #include <GL/gl.h>
 #include <GL/glu.h>
 
+#if defined(__MINGW32__)
+#include <GL/mesa_wgl.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -108,14 +112,14 @@ extern _CRTIMP void __cdecl exit(int);
    and redifinition of Windows system defs, also removes requirement of
    pretty much any standard windows header from this file */
 
-#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
+#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
 #      define GLUTAPIENTRY __stdcall
 #else
 #      define GLUTAPIENTRY
 #endif
 
 /* GLUT API entry point declarations for Win32. */
-#if defined(GLUT_BUILDING_LIB) && defined(_DLL)
+#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
 #      define GLUTAPI __declspec(dllexport)
 #elif defined(_DLL)
 #   define GLUTAPI __declspec(dllimport)
@@ -130,9 +134,12 @@ extern _CRTIMP void __cdecl exit(int);
 #              pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
 #      endif
 #      define CALLBACK __stdcall
-typedef int (GLUTAPIENTRY *PROC)();
-typedef void *HGLRC;
-typedef void *HDC;
+
+#if !defined(__MINGW32__)
+       typedef int (GLUTAPIENTRY *PROC)();
+       typedef void *HGLRC;
+       typedef void *HDC;
+#endif
 typedef unsigned long COLORREF;
 #endif
 
@@ -193,13 +200,11 @@ WGLAPI int   GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
 #else /* _WIN32 not defined */
 
 /* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */
-#  define GLUTAPIENTRY
+#  define GLUTAPIENTRY GLAPIENTRY
 #  define GLUTAPIENTRYV
-#  define GLUT_APIENTRY_DEFINED
 #  define GLUTCALLBACK
 #  define GLUTAPI extern
-/* Prototype exit for the non-Win32 case (see above). */
-/*extern void exit(int);  this screws up gcc -ansi -pedantic! */
+
 #endif
 
 
@@ -664,7 +669,8 @@ GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
 GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
 #endif
 #if (GLUT_API_VERSION >= 5)
-GLUTAPI void * GLUTAPIENTRY glutGetProcAddress(const char *procName);
+typedef void (*GLUTproc)();
+GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName);
 #endif
 
 /* GLUT font sub-API */
@@ -746,26 +752,4 @@ GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
 }
 #endif
 
-#if 0
-#ifdef GLUT_APIENTRY_DEFINED
-# undef GLUT_APIENTRY_DEFINED
-# undef APIENTRY
-#endif
-
-#ifdef GLUT_WINGDIAPI_DEFINED
-# undef GLUT_WINGDIAPI_DEFINED
-# undef WINGDIAPI
-#endif
-
-#ifdef GLUT_DEFINED___CDECL
-# undef GLUT_DEFINED___CDECL
-# undef __cdecl
-#endif
-
-#ifdef GLUT_DEFINED__CRTIMP
-# undef GLUT_DEFINED__CRTIMP
-# undef _CRTIMP
-#endif
-#endif
-
 #endif                  /* __glut_h__ */