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 0e929ddf26
commit f594efefe8
3 changed files with 15 additions and 6 deletions

View file

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

View file

@ -664,6 +664,7 @@ private:
sint32 _WindowWidth, _WindowHeight, _WindowX, _WindowY;
nlWindow _win;
bool _DestroyWindow;
#ifdef NL_OS_WINDOWS
@ -675,7 +676,6 @@ private:
static uint _Registered;
DEVMODE _OldScreenMode;
NLMISC::CEventEmitterMulti _EventEmitter; // this can contains a win emitter and eventually a direct input emitter
bool _DestroyWindow;
// Off-screen rendering in Dib section
HPBUFFERARB _PBuffer;
@ -689,6 +689,7 @@ private:
GLXContext _ctx;
Cursor _cursor;
NLMISC::CUnixEventEmitter _EventEmitter;
XVisualInfo* _visual_info;
#ifdef XF86VIDMODE
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");
}
if (wnd != EmptyWindow)
_visual_info = visual_info;
if (wnd == EmptyWindow)
{
if (!createWindow(mode))
return false;
@ -929,6 +931,9 @@ bool CDriverGL::createWindow(const GfxMode &mode)
#elif defined (NL_OS_UNIX)
if (_visual_info == NULL)
return false;
XSetWindowAttributes attr;
attr.background_pixel = BlackPixel(_dpy, DefaultScreen(_dpy));
@ -952,10 +957,10 @@ bool CDriverGL::createWindow(const GfxMode &mode)
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;
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)
{
@ -1595,7 +1600,7 @@ void CDriverGL::getWindowPos(uint32 &x, uint32 &y)
unsigned int depth = 0;
// 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");
}