Changed: Minor changes for X implementations

This commit is contained in:
kervala 2010-11-21 22:21:34 +01:00
parent e5b16b911b
commit 80e31822b6

View file

@ -2229,14 +2229,17 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
// first time requesting decoration sizes if (!_FullScreen)
if (_WindowX && _WindowY && !_DecorationWidth && !_DecorationHeight && _WndActive)
{ {
_DecorationWidth = -1; // first time requesting decoration sizes
_DecorationHeight = -1; 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
} }
@ -2459,7 +2462,26 @@ void CDriverGL::setWindowSize(uint32 width, uint32 height)
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
if (width != _WindowWidth || height != _WindowHeight) if (!_Resizable)
{
// Update WM hints (disallow resizing)
XSizeHints *size_hints = XAllocSizeHints();
size_hints->flags = PMinSize | PMaxSize;
size_hints->min_width = width;
size_hints->min_height = height;
size_hints->max_width = width;
size_hints->max_height = height;
XSetWMNormalHints(_dpy, _win, size_hints);
XFree(size_hints);
}
else
{
XSetWMNormalHints(_dpy, _win, StdHints);
}
if (width != _CurrentMode.Width || height != _CurrentMode.Height)
{ {
// resize the window // resize the window
XResizeWindow(_dpy, _win, width, height); XResizeWindow(_dpy, _win, width, height);
@ -2468,21 +2490,6 @@ void CDriverGL::setWindowSize(uint32 width, uint32 height)
_CurrentMode.Height = height; _CurrentMode.Height = height;
} }
// Update WM hints (allow resizing)
XSizeHints size_hints;
size_hints.flags = 0;
if (!_Resizable || _FullScreen)
{
size_hints.flags |= PMinSize | PMaxSize;
size_hints.min_width = width;
size_hints.min_height = height;
size_hints.max_width = width;
size_hints.max_height = height;
}
XSetWMNormalHints(_dpy, _win, &size_hints);
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
} }
@ -2497,11 +2504,8 @@ void CDriverGL::getWindowPos(sint32 &x, sint32 &y)
} }
else else
{ {
if (_win) x = _WindowX;
{ y = _WindowY;
x = _WindowX;
y = _WindowY;
}
} }
} }