Fixed: #981 Create createWindow and destroyWindow private methods in OpenGL driver

This commit is contained in:
kervala 2010-06-12 23:01:46 +02:00
parent ac9cc23f0c
commit 48b75f62b5
3 changed files with 15 additions and 6 deletions

View file

@ -206,17 +206,20 @@ CDriverGL::CDriverGL()
NL3D::MAC::ctor(); NL3D::MAC::ctor();
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
_cursor = None; _cursor = None;
_dpy = 0; _dpy = 0;
_visual_info = NULL;
# ifdef XF86VIDMODE # ifdef XF86VIDMODE
// zero the old screen mode // zero the old screen mode
memset(&_OldScreenMode, 0, sizeof(_OldScreenMode)); memset(&_OldScreenMode, 0, sizeof(_OldScreenMode));
# endif //XF86VIDMODE # endif //XF86VIDMODE
#endif // NL_OS_UNIX #endif // NL_OS_UNIX
_win = EmptyWindow; _win = EmptyWindow;
_DestroyWindow = false;
_OffScreen = false; _OffScreen = false;
_FullScreen = false; _FullScreen = false;

View file

@ -664,6 +664,7 @@ private:
sint32 _WindowWidth, _WindowHeight, _WindowX, _WindowY; sint32 _WindowWidth, _WindowHeight, _WindowX, _WindowY;
nlWindow _win; nlWindow _win;
bool _DestroyWindow;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -675,7 +676,6 @@ private:
static uint _Registered; static uint _Registered;
DEVMODE _OldScreenMode; DEVMODE _OldScreenMode;
NLMISC::CEventEmitterMulti _EventEmitter; // this can contains a win emitter and eventually a direct input emitter NLMISC::CEventEmitterMulti _EventEmitter; // this can contains a win emitter and eventually a direct input emitter
bool _DestroyWindow;
// Off-screen rendering in Dib section // Off-screen rendering in Dib section
HPBUFFERARB _PBuffer; HPBUFFERARB _PBuffer;
@ -689,6 +689,7 @@ private:
GLXContext _ctx; GLXContext _ctx;
Cursor _cursor; Cursor _cursor;
NLMISC::CUnixEventEmitter _EventEmitter; NLMISC::CUnixEventEmitter _EventEmitter;
XVisualInfo* _visual_info;
#ifdef XF86VIDMODE #ifdef XF86VIDMODE
int _OldDotClock; // old dotclock int _OldDotClock; // old dotclock

View file

@ -674,7 +674,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
nlerror("glXCreateContext() failed"); nlerror("glXCreateContext() failed");
} }
if (wnd != EmptyWindow) _visual_info = visual_info;
if (wnd == EmptyWindow)
{ {
if (!createWindow(mode)) if (!createWindow(mode))
return false; return false;
@ -929,6 +931,9 @@ bool CDriverGL::createWindow(const GfxMode &mode)
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
if (_visual_info == NULL)
return false;
XSetWindowAttributes attr; XSetWindowAttributes attr;
attr.background_pixel = BlackPixel(_dpy, DefaultScreen(_dpy)); attr.background_pixel = BlackPixel(_dpy, DefaultScreen(_dpy));
@ -952,10 +957,10 @@ bool CDriverGL::createWindow(const GfxMode &mode)
nlWindow root = RootWindow(_dpy, DefaultScreen(_dpy)); nlWindow root = RootWindow(_dpy, DefaultScreen(_dpy));
attr.colormap = XCreateColormap(_dpy, root, visual_info->visual, AllocNone); attr.colormap = XCreateColormap(_dpy, root, _visual_info->visual, AllocNone);
attr_flags |= CWColormap; attr_flags |= CWColormap;
window = XCreateWindow (_dpy, root, 0, 0, mode.Width, mode.Height, 0, visual_info->depth, InputOutput, visual_info->visual, attr_flags, &attr); window = XCreateWindow (_dpy, root, 0, 0, mode.Width, mode.Height, 0, _visual_info->depth, InputOutput, _visual_info->visual, attr_flags, &attr);
if (window == EmptyWindow) if (window == EmptyWindow)
{ {
@ -1595,7 +1600,7 @@ void CDriverGL::getWindowPos(uint32 &x, uint32 &y)
unsigned int depth = 0; unsigned int depth = 0;
// Get geometry information about root window // Get geometry information about root window
if (!XGetGeometry(_dpy, RootWindow(_dpy, screen), &_win, &xtmp, &ytmp, &width, &height, &border_width, &depth)) if (!XGetGeometry(_dpy, RootWindow(_dpy, screen), (Window*)&_win, &xtmp, &ytmp, &width, &height, &border_width, &depth))
{ {
nlwarning("can't get root window geometry"); nlwarning("can't get root window geometry");
} }