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
This commit is contained in:
Rene Gollent
2008-11-17 04:15:51 +00:00
parent ca9a61313a
commit 6cf3a9ebf7
2 changed files with 7 additions and 3 deletions
+4 -3
View File
@@ -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()