summaryrefslogtreecommitdiff
path: root/src/gui/widgets/window.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-04 13:07:05 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-04 13:07:05 +0300
commitf02ce95a6e99aadce48bdc608121496520639e2d (patch)
tree168daa32945e2cedaa1719adb80277e3ea0892f5 /src/gui/widgets/window.cpp
parent808a0b7aeb9c58724d3ac2e1a8bb8f3d3c2bdb1e (diff)
downloadmanaverse-f02ce95a6e99aadce48bdc608121496520639e2d.tar.gz
manaverse-f02ce95a6e99aadce48bdc608121496520639e2d.tar.bz2
manaverse-f02ce95a6e99aadce48bdc608121496520639e2d.tar.xz
manaverse-f02ce95a6e99aadce48bdc608121496520639e2d.zip
adjust windows size if main window was resized to smaller size.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r--src/gui/widgets/window.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index cd00d2568..36372dcaa 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -1059,6 +1059,28 @@ void Window::adjustPositionAfterResize(const int oldScreenWidth,
}
ensureOnScreen();
+ adjustSizeToScreen();
+}
+
+void Window::adjustSizeToScreen()
+{
+ if (!mGrip)
+ return;
+
+ const int screenWidth = mainGraphics->mWidth;
+ const int screenHeight = mainGraphics->mHeight;
+ const int oldWidth = mDimension.width;
+ const int oldHeight = mDimension.height;
+ if (oldWidth + mDimension.x > screenWidth)
+ mDimension.x = 0;
+ if (oldHeight + mDimension.y > screenHeight)
+ mDimension.x = 0;
+ if (mDimension.width > screenWidth)
+ mDimension.width = screenWidth;
+ if (mDimension.height > screenHeight)
+ mDimension.height = screenHeight;
+ if (oldWidth != mDimension.width || oldHeight != mDimension.height)
+ widgetResized(gcn::Event(this));
}
int Window::getResizeHandles(const gcn::MouseEvent &event)