The Mouse window is now centered if it's too close to the border of the

screen when shown (on start). Usually it was put in the top left corner 
on the screen when you first start it (very annoying).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20744 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-04-18 07:34:49 +00:00
parent ca615cfc7a
commit 2e2e58a452
1 changed files with 5 additions and 6 deletions

View File

@ -69,15 +69,14 @@ MouseWindow::MouseWindow(BRect _rect)
// check if the window is on screen
rect = BScreen().Frame();
rect.right -= 20;
rect.bottom -= 20;
rect.InsetBySelf(20, 20);
BPoint position = fSettings.WindowPosition();
if (!rect.Contains(BRect(position,
Bounds().OffsetBySelf(position).RightBottom()))) {
BRect windowFrame = Frame().OffsetToSelf(position);
if (!rect.Contains(windowFrame)) {
// center window on screen as it doesn't fit on the saved position
position.x = (rect.Width() - Bounds().Width()) / 2;
position.y = (rect.Height() - Bounds().Height()) / 2;
position.x = (rect.Width() - windowFrame.Width()) / 2;
position.y = (rect.Height() - windowFrame.Height()) / 2;
if (position.x < 0)
position.x = 0;
if (position.y < 0)