diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-12 20:17:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-12 20:17:36 +0300 |
commit | da1b2d8311ca78eccd3e9875598562ce6bf05cab (patch) | |
tree | dec1e1e46e242c0cd3e1b764db31fa591629c385 | |
parent | d085ae2b90d332f145cd2bf5a0d3e39435ddba02 (diff) | |
download | plus-da1b2d8311ca78eccd3e9875598562ce6bf05cab.tar.gz plus-da1b2d8311ca78eccd3e9875598562ce6bf05cab.tar.bz2 plus-da1b2d8311ca78eccd3e9875598562ce6bf05cab.tar.xz plus-da1b2d8311ca78eccd3e9875598562ce6bf05cab.zip |
Fix windows size if part of window showed out of screen.
-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() |