From 6cf3a9ebf7bd44b294c1def7ac2fc836df5b468a Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 17 Nov 2008 04:15:51 +0000 Subject: [PATCH] The previous commit exposed another bug: BWindow::Zoom() incorrectly calculated the max height of the window by only including the border width once. This was previously masked by the fact that the (by default 5) extra pixels were included in its hardcoded default for the height of the tab. Also add the border width to the message returned by GetDecoratorSettings() so Zoom can use the actual value instead of hardcoding it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28679 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Window.cpp | 7 ++++--- src/servers/app/DefaultDecorator.cpp | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 6608c7c9f1..1b6a7e1dec 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1533,12 +1533,13 @@ BWindow::Zoom() // fallback in case retrieving the decorator settings fails (highly unlikely) float borderWidth = 5.0; - float tabHeight = 26.0; + float tabHeight = 21.0; BMessage settings; if (GetDecoratorSettings(&settings) == B_OK) { BRect tabRect; if (settings.FindRect("tab frame", &tabRect) == B_OK) tabHeight = tabRect.Height(); + settings.FindFloat("border width", &borderWidth); } // 1) the rectangle defined by SetZoomLimits(), @@ -1554,13 +1555,13 @@ BWindow::Zoom() // 3) the screen rectangle BScreen screen(this); float screenWidth = screen.Frame().Width() - 2 * borderWidth; - float screenHeight = screen.Frame().Height() - (borderWidth + tabHeight); + float screenHeight = screen.Frame().Height() - (2 * borderWidth + tabHeight); if (screenWidth < zoomedWidth) zoomedWidth = screenWidth; if (screenHeight < zoomedHeight) zoomedHeight = screenHeight; - BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth, tabHeight); + BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth, tabHeight + borderWidth); // UN-ZOOM: if (fPreviousFrame.IsValid() diff --git a/src/servers/app/DefaultDecorator.cpp b/src/servers/app/DefaultDecorator.cpp index b0bb79095e..e2754e0598 100644 --- a/src/servers/app/DefaultDecorator.cpp +++ b/src/servers/app/DefaultDecorator.cpp @@ -449,6 +449,9 @@ DefaultDecorator::GetSettings(BMessage* settings) const if (settings->AddRect("tab frame", fTabRect) != B_OK) return false; + if (settings->AddFloat("border width", fBorderWidth) != B_OK) + return false; + return settings->AddFloat("tab location", (float)fTabOffset) == B_OK; }