From 72f5288682f46af1f7c04c002172178c880e060b Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 7 Dec 2008 15:23:34 +0100 Subject: Fixed inconsistency in default window sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default window sizes were all too small, since they were specified in content size. On pressing "Reset Windows", the sizes would be interpreted as such and apply alright. The inconsistency is now removed, and the default window sizes are always the size of the whole widget now, not just the contents. Signed-off-by: Bjørn Lindeijer --- src/gui/window.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/gui/window.cpp') diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 58544f7e..602441fb 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -240,7 +240,7 @@ void Window::setMaxHeight(unsigned int height) void Window::setResizable(bool r) { - if ((bool)mGrip == r) return; + if ((bool) mGrip == r) return; if (r) { @@ -258,9 +258,12 @@ void Window::setResizable(bool r) void Window::widgetResized(const gcn::Event &event) { + const gcn::Rectangle area = getChildrenArea(); + + mChrome->setSize(area.width, area.height); + if (mGrip) { - gcn::Rectangle const &area = getChildrenArea(); mGrip->setPosition(getWidth() - mGrip->getWidth() - area.x, getHeight() - mGrip->getHeight() - area.y); } @@ -465,13 +468,10 @@ void Window::mouseDragged(gcn::MouseEvent &event) // Set the new window and content dimensions setDimension(newDim); - const gcn::Rectangle area = getChildrenArea(); - mChrome->setSize(area.width, area.height); } } -void -Window::loadWindowState() +void Window::loadWindowState() { const std::string &name = mWindowName; assert(!name.empty()); @@ -484,13 +484,10 @@ Window::loadWindowState() { setSize((int) config.getValue(name + "WinWidth", mDefaultWidth), (int) config.getValue(name + "WinHeight", mDefaultHeight)); - - const gcn::Rectangle area = getChildrenArea(); - mChrome->setSize(area.width, area.height); } else { - setContentSize(mDefaultWidth, mDefaultHeight); + setSize(mDefaultWidth, mDefaultHeight); } } @@ -506,7 +503,7 @@ void Window::setDefaultSize(int defaultX, int defaultY, void Window::resetToDefaultSize() { setPosition(mDefaultX, mDefaultY); - setContentSize(mDefaultWidth, mDefaultHeight); + setSize(mDefaultWidth, mDefaultHeight); } int Window::getResizeHandles(gcn::MouseEvent &event) -- cgit v1.2.3-70-g09d2