Fixed: #1046 XConfigureNotify window position different from XMoveWindow
This commit is contained in:
parent
dd93616bf6
commit
1fab114680
3 changed files with 45 additions and 5 deletions
|
@ -207,6 +207,9 @@ CDriverGL::CDriverGL()
|
||||||
_win = EmptyWindow;
|
_win = EmptyWindow;
|
||||||
_DestroyWindow = false;
|
_DestroyWindow = false;
|
||||||
|
|
||||||
|
_DecorationWidth = 0;
|
||||||
|
_DecorationHeight = 0;
|
||||||
|
|
||||||
_OffScreen = false;
|
_OffScreen = false;
|
||||||
_FullScreen = false;
|
_FullScreen = false;
|
||||||
_Resizable = false;
|
_Resizable = false;
|
||||||
|
|
|
@ -681,6 +681,8 @@ private:
|
||||||
|
|
||||||
nlWindow _win;
|
nlWindow _win;
|
||||||
bool _DestroyWindow;
|
bool _DestroyWindow;
|
||||||
|
sint32 _DecorationWidth;
|
||||||
|
sint32 _DecorationHeight;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -175,12 +175,40 @@ bool GlWndProc(CDriverGL *driver, XEvent &e)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MapNotify:
|
||||||
|
driver->_WndActive = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UnmapNotify:
|
||||||
|
driver->_WndActive = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Expose:
|
||||||
|
nlwarning("Expose event");
|
||||||
|
break;
|
||||||
|
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
|
|
||||||
driver->_WindowWidth = e.xconfigure.width;
|
if (!driver->_FullScreen && driver->_WndActive)
|
||||||
driver->_WindowHeight = e.xconfigure.height;
|
{
|
||||||
driver->_WindowX = e.xconfigure.x;
|
// first time setting decoration sizes
|
||||||
driver->_WindowY = e.xconfigure.y;
|
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;
|
break;
|
||||||
|
|
||||||
|
@ -1802,7 +1830,7 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
|
||||||
_WindowX = x;
|
_WindowX = x;
|
||||||
_WindowY = y;
|
_WindowY = y;
|
||||||
|
|
||||||
if (_win == EmptyWindow)
|
if (_win == EmptyWindow || _FullScreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
@ -1815,6 +1843,13 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
|
||||||
|
|
||||||
#elif defined (NL_OS_UNIX)
|
#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);
|
XMoveWindow(_dpy, _win, x, y);
|
||||||
|
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
Loading…
Reference in a new issue