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
+1 -11
View File
@@ -1954,11 +1954,7 @@
/*! /*!
\fn void BWindow::CenterOnScreen() \fn void BWindow::CenterOnScreen()
\brief Centers the window on the current screen. \brief Centers the window on the screen the window is currently on.
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 \since Haiku R1
*/ */
@@ -1968,12 +1964,6 @@
\fn void BWindow::CenterOnScreen(screen_id id) \fn void BWindow::CenterOnScreen(screen_id id)
\brief Centers the window on the screen with the passed in \a 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 \since Haiku R1
*/ */
-2
View File
@@ -366,8 +366,6 @@ private:
float* _tabHeight) const; float* _tabHeight) const;
void _SendShowOrHideMessage(); void _SendShowOrHideMessage();
void _CenterAboveCenter(BRect rect);
private: private:
char* fTitle; char* fTitle;
int32 _unused0; int32 _unused0;
+3 -46
View File
@@ -2568,7 +2568,6 @@ BWindow::ResizeToPreferred()
} }
// Centers the window in rect.
void void
BWindow::CenterIn(const BRect& rect) 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 void
BWindow::CenterOnScreen() BWindow::CenterOnScreen()
{ {
BRect screenFrame(BScreen(this).Frame()); CenterIn(BScreen(this).Frame());
_CenterAboveCenter(screenFrame);
} }
// 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 void
BWindow::CenterOnScreen(screen_id id) BWindow::CenterOnScreen(screen_id id)
{ {
BRect screenFrame(BScreen(id).Frame()); CenterIn(BScreen(id).Frame());
_CenterAboveCenter(screenFrame);
} }
@@ -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 // #pragma mark - C++ binary compatibility kludge