From 8d1fc88170fd654a9ae84a6a41669221a5457abc Mon Sep 17 00:00:00 2001 From: leavengood Date: Mon, 27 Dec 2010 22:12:55 +0000 Subject: [PATCH] As indicated by Axel the border width for positioning the download window was hard-coded. This fixes that and refactors the code a bit. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@555 94f232f2-1747-11df-bad5-a5bfde151594 --- src/apps/webpositive/BrowserApp.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/apps/webpositive/BrowserApp.cpp b/src/apps/webpositive/BrowserApp.cpp index b9f905fb70..1504638ae7 100644 --- a/src/apps/webpositive/BrowserApp.cpp +++ b/src/apps/webpositive/BrowserApp.cpp @@ -152,13 +152,7 @@ BrowserApp::ReadyToRun() #endif fLastWindowFrame = fSettings->GetValue("window frame", fLastWindowFrame); - // Put download window in lower right of screen. 375 is about the minimum - // width with the default layout. - BRect defaultDownloadWindowFrame(0, 0, 375, 275); - BRect screenFrame = BScreen().Frame(); - // The extra 5 pixels is for the decorator frame - defaultDownloadWindowFrame.OffsetTo(screenFrame.Width() - defaultDownloadWindowFrame.Width() - 5, - screenFrame.Height() - defaultDownloadWindowFrame.Height() - 5); + BRect defaultDownloadWindowFrame(-10, -10, 365, 265); BRect downloadWindowFrame = fSettings->GetValue("downloads window frame", defaultDownloadWindowFrame); BRect settingsWindowFrame = fSettings->GetValue("settings window frame", @@ -167,6 +161,17 @@ BrowserApp::ReadyToRun() fDownloadWindow = new DownloadWindow(downloadWindowFrame, showDownloads, fSettings); + if (downloadWindowFrame == defaultDownloadWindowFrame) { + // Initially put download window in lower right of screen. + BRect screenFrame = BScreen().Frame(); + BMessage decoratorSettings; + fDownloadWindow->GetDecoratorSettings(&decoratorSettings); + float borderWidth = 0; + if (decoratorSettings.FindFloat("border width", &borderWidth) != B_OK) + borderWidth = 5; + fDownloadWindow->MoveTo(screenFrame.Width() - fDownloadWindow->Frame().Width() - borderWidth, + screenFrame.Height() - fDownloadWindow->Frame().Height() - borderWidth); + } fSettingsWindow = new SettingsWindow(settingsWindowFrame, fSettings); BWebPage::SetDownloadListener(BMessenger(fDownloadWindow));