From e8d4a664cc33bef0bee26be9b1c13d5d68a781af Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 17 Aug 2002 17:49:27 +0000 Subject: [PATCH] Added a way to get the Windows OpenGL context in SDL_syswm.h --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40439 --- include/SDL_syswm.h | 2 ++ src/video/wincommon/SDL_syswm.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index dba56dcb6..a0cb08a81 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -111,6 +111,7 @@ typedef struct { } SDL_SysWMinfo; #elif defined(WIN32) +#define WIN32_LEAN_AND_MEAN #include /* The windows custom event structure */ @@ -126,6 +127,7 @@ struct SDL_SysWMmsg { typedef struct { SDL_version version; HWND window; /* The Win32 display window */ + HGLRC hglrc; /* The OpenGL context, if any */ } SDL_SysWMinfo; #else diff --git a/src/video/wincommon/SDL_syswm.c b/src/video/wincommon/SDL_syswm.c index c33f14557..25ede4412 100644 --- a/src/video/wincommon/SDL_syswm.c +++ b/src/video/wincommon/SDL_syswm.c @@ -267,6 +267,16 @@ int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info) { if ( info->version.major <= SDL_MAJOR_VERSION ) { info->window = SDL_Window; + if ( SDL_VERSIONNUM(info->version.major, + info->version.minor, + info->version.patch) >= + SDL_VERSION(1, 2, 5) ) { +#ifdef HAVE_OPENGL + info->hglrc = GL_hrc; +#else + info->hglrc = NULL; +#endif + } return(1); } else { SDL_SetError("Application not compiled with SDL %d.%d\n",