Added a way to get the Windows OpenGL context in SDL_syswm.h
authorSam Lantinga <slouken@libsdl.org>
Sat, 17 Aug 2002 17:49:27 +0000
changeset 438f9c5f135a8b9
parent 437 5602f069ccb2
child 439 3ac8344e3872
Added a way to get the Windows OpenGL context in SDL_syswm.h
include/SDL_syswm.h
src/video/wincommon/SDL_syswm.c
     1.1 --- a/include/SDL_syswm.h	Sat Aug 17 17:21:04 2002 +0000
     1.2 +++ b/include/SDL_syswm.h	Sat Aug 17 17:49:27 2002 +0000
     1.3 @@ -111,6 +111,7 @@
     1.4  } SDL_SysWMinfo;
     1.5  
     1.6  #elif defined(WIN32)
     1.7 +#define WIN32_LEAN_AND_MEAN
     1.8  #include <windows.h>
     1.9  
    1.10  /* The windows custom event structure */
    1.11 @@ -126,6 +127,7 @@
    1.12  typedef struct {
    1.13  	SDL_version version;
    1.14  	HWND window;			/* The Win32 display window */
    1.15 +	HGLRC hglrc;			/* The OpenGL context, if any */
    1.16  } SDL_SysWMinfo;
    1.17  
    1.18  #else
     2.1 --- a/src/video/wincommon/SDL_syswm.c	Sat Aug 17 17:21:04 2002 +0000
     2.2 +++ b/src/video/wincommon/SDL_syswm.c	Sat Aug 17 17:49:27 2002 +0000
     2.3 @@ -267,6 +267,16 @@
     2.4  {
     2.5  	if ( info->version.major <= SDL_MAJOR_VERSION ) {
     2.6  		info->window = SDL_Window;
     2.7 +		if ( SDL_VERSIONNUM(info->version.major,
     2.8 +		                    info->version.minor,
     2.9 +		                    info->version.patch) >=
    2.10 +		     SDL_VERSION(1, 2, 5) ) {
    2.11 +#ifdef HAVE_OPENGL
    2.12 +			info->hglrc = GL_hrc;
    2.13 +#else
    2.14 +			info->hglrc = NULL;
    2.15 +#endif
    2.16 +		}
    2.17  		return(1);
    2.18  	} else {
    2.19  		SDL_SetError("Application not compiled with SDL %d.%d\n",