Revert "BWindow: CenterOnScreen a bit above center"

This reverts commit a5be1832cc.
This commit is contained in:
John Scipione 2017-01-01 12:25:05 -08:00
parent 74d5847f99
commit e1304871bb
3 changed files with 4 additions and 59 deletions

View File

@ -1954,11 +1954,7 @@
/*!
\fn void BWindow::CenterOnScreen()
\brief Centers the window on the current screen.
The window is positioned on the screen a bit above center. If you want to
center the window exactly in the middle you'll need to use
BWindow::CenterIn() instead.
\brief Centers the window on the screen the window is currently on.
\since Haiku R1
*/
@ -1968,12 +1964,6 @@
\fn void BWindow::CenterOnScreen(screen_id id)
\brief Centers the window on the screen with the passed in \a id.
\param id The screen_id of the screen to center the window in.
The window is positioned on the screen a bit above center. If you want to
center the window exactly in the middle you'll need to use
BWindow::CenterIn() instead.
\since Haiku R1
*/

View File

@ -366,8 +366,6 @@ private:
float* _tabHeight) const;
void _SendShowOrHideMessage();
void _CenterAboveCenter(BRect rect);
private:
char* fTitle;
int32 _unused0;

View File

@ -2568,7 +2568,6 @@ BWindow::ResizeToPreferred()
}
// Centers the window in rect.
void
BWindow::CenterIn(const BRect& rect)
{
@ -2583,21 +2582,18 @@ BWindow::CenterIn(const BRect& rect)
}
// Centers the window offset a bit above center on the current screen.
void
BWindow::CenterOnScreen()
{
BRect screenFrame(BScreen(this).Frame());
_CenterAboveCenter(screenFrame);
CenterIn(BScreen(this).Frame());
}
// Centers the window offset a bit above center on the screen specified by id.
// Centers the window on the screen with the passed in id.
void
BWindow::CenterOnScreen(screen_id id)
{
BRect screenFrame(BScreen(id).Frame());
_CenterAboveCenter(screenFrame);
CenterIn(BScreen(id).Frame());
}
@ -4184,45 +4180,6 @@ BWindow::_SendShowOrHideMessage()
}
// Centers the window in the rect offset a bit above center.
void
BWindow::_CenterAboveCenter(BRect rect)
{
BAutolock locker(this);
// Set size limits now if needed
UpdateSizeLimits();
BPoint centered = BLayoutUtils::AlignInFrame(rect, Size(),
BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER))
.LeftTop();
centered.y -= floorf(rect.Height() / 16);
// Offset y coordinate so that the window is positioned like this:
// ----------------------------------------------------------
// | |
// | |
// | _________ |
// | [_]_______|_____________ |
// | | | |
// | | | |
// | | | |
// | | | |
// | | | |
// | | | |
// | |_______________________| |
// | |
// | |
// | |
// | |
// | |
// | |
// ----------------------------------------------------------
MoveTo(centered);
}
// #pragma mark - C++ binary compatibility kludge