Fixed: #984 Create setWindowStyle and getWindowStyle private methods in OpenGL driver

This commit is contained in:
kervala 2010-06-15 17:44:03 +02:00
parent cb649eba75
commit 3ed8f85188

View file

@ -718,15 +718,12 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
if (!setupDisplay()) if (!setupDisplay())
return false; return false;
if (_DestroyWindow) // setup window size and screen mode
{ if (!setMode(mode))
// setup window size and screen mode return false;
if (!setMode(mode))
return false;
if (show || _FullScreen) if (show || _FullScreen)
showWindow(true); showWindow(true);
}
return true; return true;
} }
@ -971,7 +968,7 @@ bool CDriverGL::destroyWindow()
if (_hDC) if (_hDC)
wglMakeCurrent(_hDC, NULL); wglMakeCurrent(_hDC, NULL);
if (_hRC) if (_DestroyWindow && _hRC)
{ {
wglDeleteContext(_hRC); wglDeleteContext(_hRC);
_hRC = NULL; _hRC = NULL;
@ -993,14 +990,16 @@ bool CDriverGL::destroyWindow()
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
if (_ctx) if (_DestroyWindow)
{ {
glXDestroyContext(_dpy, _ctx); if (_ctx)
_ctx = NULL; glXDestroyContext(_dpy, _ctx);
if (_win)
XDestroyWindow(_dpy, _win);
} }
if (_win && _DestroyWindow) _ctx = NULL;
XDestroyWindow(_dpy, _win);
// Ungrab the keyboard (probably not necessary); // Ungrab the keyboard (probably not necessary);
// XUnmapWindow(_dpy, _win); // XUnmapWindow(_dpy, _win);
@ -1028,6 +1027,10 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
{ {
H_AUTO_OGL(CDriverGL_setWindowStyle) H_AUTO_OGL(CDriverGL_setWindowStyle)
// don't change window style, if we did not create the window
if (!_DestroyWindow)
return true;
#if defined(NL_OS_WINDOWS) #if defined(NL_OS_WINDOWS)
// get current style // get current style
@ -1329,6 +1332,12 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
// *************************************************************************** // ***************************************************************************
void CDriverGL::showWindow(bool show) void CDriverGL::showWindow(bool show)
{ {
H_AUTO_OGL(CDriverGL_showWindow)
// don't change window visibility, if we didn't create the window
if (!_DestroyWindow)
return;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
ShowWindow (_win, show ? SW_SHOW:SW_HIDE); ShowWindow (_win, show ? SW_SHOW:SW_HIDE);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
@ -1354,6 +1363,7 @@ void CDriverGL::showWindow(bool show)
emptyProc CDriverGL::getWindowProc() emptyProc CDriverGL::getWindowProc()
{ {
H_AUTO_OGL(CDriverGL_getWindowProc) H_AUTO_OGL(CDriverGL_getWindowProc)
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
return (emptyProc)GlWndProc; return (emptyProc)GlWndProc;
#else // NL_OS_WINDOWS #else // NL_OS_WINDOWS