diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/window.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 14f39a4c3..72530db8f 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -665,6 +665,22 @@ void Window::loadWindowState() // Check if the window is off screen... checkIfIsOffScreen(); + + if (viewport) + { + int width = getWidth(); + int height = getHeight(); + + if (getX() + width >= viewport->getWidth()) + width = viewport->getWidth() - getX() - 1; + if (getY() + height >= viewport->getHeight()) + height = viewport->getHeight() - getY() - 1; + if (width < 0) + width = 0; + if (height < 0) + height = 0; + setSize(width, height); + } } void Window::saveWindowState() |