Fixed: #1046 XConfigureNotify window position different from XMoveWindow

This commit is contained in:
kervala 2010-08-01 09:32:12 +02:00
parent 33613b8cec
commit 6df4bfa96c
3 changed files with 45 additions and 5 deletions

View file

@ -207,6 +207,9 @@ CDriverGL::CDriverGL()
_win = EmptyWindow;
_DestroyWindow = false;
_DecorationWidth = 0;
_DecorationHeight = 0;
_OffScreen = false;
_FullScreen = false;
_Resizable = false;

View file

@ -681,6 +681,8 @@ private:
nlWindow _win;
bool _DestroyWindow;
sint32 _DecorationWidth;
sint32 _DecorationHeight;
#ifdef NL_OS_WINDOWS

View file

@ -175,12 +175,40 @@ bool GlWndProc(CDriverGL *driver, XEvent &e)
}
break;
case MapNotify:
driver->_WndActive = true;
break;
case UnmapNotify:
driver->_WndActive = false;
break;
case Expose:
nlwarning("Expose event");
break;
case ConfigureNotify:
driver->_WindowWidth = e.xconfigure.width;
driver->_WindowHeight = e.xconfigure.height;
driver->_WindowX = e.xconfigure.x;
driver->_WindowY = e.xconfigure.y;
if (!driver->_FullScreen && driver->_WndActive)
{
// first time setting decoration sizes
if ((driver->_DecorationWidth == -1) || (driver->_DecorationWidth == 0))
{
driver->_DecorationWidth = e.xconfigure.x - driver->_WindowX;
driver->_DecorationHeight = e.xconfigure.y - driver->_WindowY;
nlwarning("Decoration size x = %d, y = %d", driver->_DecorationWidth, driver->_DecorationHeight);
}
driver->_WindowWidth = e.xconfigure.width;
driver->_WindowHeight = e.xconfigure.height;
driver->_WindowX = e.xconfigure.x - driver->_DecorationWidth;
driver->_WindowY = e.xconfigure.y - driver->_DecorationHeight;
XConfigureEvent event = e.xconfigure;
nlwarning("Configure x = %d, y = %d, width = %d, height = %d, send event = %d", event.x, event.y, event.width, event.height, event.send_event);
}
break;
@ -1802,7 +1830,7 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
_WindowX = x;
_WindowY = y;
if (_win == EmptyWindow)
if (_win == EmptyWindow || _FullScreen)
return;
#ifdef NL_OS_WINDOWS
@ -1815,6 +1843,13 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
#elif defined (NL_OS_UNIX)
// first time requesting decoration sizes
if (_WindowX && _WindowY && !_DecorationWidth && !_DecorationHeight && _WndActive)
{
_DecorationWidth = -1;
_DecorationHeight = -1;
}
XMoveWindow(_dpy, _win, x, y);
#endif // NL_OS_WINDOWS