mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 15:41:24 +02:00
- updated windows build for sdl2
This commit is contained in:
@@ -70,11 +70,10 @@ map<wchar_t,bool> Window::mapAllowedKeys;
|
||||
static HWND GetSDLWindow()
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
|
||||
SDL_VERSION(&info.version);
|
||||
if (SDL_GetWMInfo(&info) == -1)
|
||||
if (SDL_GetWindowWMInfo(Window::getSDLWindow(),&info) == -1)
|
||||
return NULL;
|
||||
return info.window;
|
||||
return info.info.win.window;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -525,7 +524,7 @@ void Window::create() {
|
||||
// nothing here
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
#ifdef WIN32
|
||||
ontop_win32(this->w,this->h);
|
||||
ontop_win32(this->getScreenWidth(),this->getScreenHeight());
|
||||
#endif
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
@@ -111,13 +111,13 @@ bool WindowGl::ChangeVideoMode(bool preserveContext, int resWidth, int resHeight
|
||||
if(preserveContext == true) {
|
||||
// get window handle from SDL
|
||||
SDL_VERSION(&info.version);
|
||||
if (SDL_GetWMInfo(&info) == -1) {
|
||||
if (SDL_GetWindowWMInfo(Window::getSDLWindow(),&info) == -1) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] SDL_GetWMInfo #1 failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
// get device context handle
|
||||
tempDC = GetDC( info.window );
|
||||
tempDC = GetDC( info.info.win.window );
|
||||
|
||||
// create temporary context
|
||||
tempRC = wglCreateContext( tempDC );
|
||||
@@ -128,10 +128,10 @@ bool WindowGl::ChangeVideoMode(bool preserveContext, int resWidth, int resHeight
|
||||
|
||||
// share resources to temporary context
|
||||
SetLastError(0);
|
||||
if (!wglShareLists(info.hglrc, tempRC)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] wglShareLists #1 failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
//if (!wglShareLists(info.info.win.hglrc, tempRC)) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] wglShareLists #1 failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
// return false;
|
||||
//}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -160,16 +160,16 @@ bool WindowGl::ChangeVideoMode(bool preserveContext, int resWidth, int resHeight
|
||||
if(preserveContext == true) {
|
||||
// previously used structure may possibly be invalid, to be sure we get it again
|
||||
SDL_VERSION(&info.version);
|
||||
if (SDL_GetWMInfo(&info) == -1) {
|
||||
if (SDL_GetWindowWMInfo(Window::getSDLWindow(),&info) == -1) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] SDL_GetWMInfo #2 failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
// share resources to new SDL-created context
|
||||
if (!wglShareLists(tempRC, info.hglrc)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] wglShareLists #2 failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
//if (!wglShareLists(tempRC, info.hglrc)) {
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] wglShareLists #2 failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// we no longer need our temporary context
|
||||
if (!wglDeleteContext(tempRC)) {
|
||||
|
@@ -10,6 +10,7 @@
|
||||
// ==============================================================
|
||||
|
||||
#include "platform_util.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <io.h>
|
||||
#include <dbghelp.h>
|
||||
@@ -392,11 +393,11 @@ void init_win32() {
|
||||
|
||||
SDL_SysWMinfo wminfo;
|
||||
SDL_VERSION(&wminfo.version)
|
||||
if (SDL_GetWMInfo(&wminfo) != 1) {
|
||||
if (SDL_GetWindowWMInfo(Window::getSDLWindow(),&wminfo) != 1) {
|
||||
// error: wrong SDL version
|
||||
}
|
||||
|
||||
HWND hwnd = wminfo.window;
|
||||
HWND hwnd = wminfo.info.win.window;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define GCL_HICON -14
|
||||
@@ -418,11 +419,11 @@ void init_win32() {
|
||||
void ontop_win32(int width, int height) {
|
||||
SDL_SysWMinfo wminfo;
|
||||
SDL_VERSION(&wminfo.version)
|
||||
if (SDL_GetWMInfo(&wminfo) != 1) {
|
||||
if (SDL_GetWindowWMInfo(Window::getSDLWindow(),&wminfo) != 1) {
|
||||
// error: wrong SDL version
|
||||
}
|
||||
|
||||
HWND hwnd = wminfo.window;
|
||||
HWND hwnd = wminfo.info.win.window;
|
||||
|
||||
SetWindowLong(hwnd, GWL_EXSTYLE, 0);
|
||||
SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
|
Reference in New Issue
Block a user