From 2e2e58a452b3ca9ce453efe84be03affa9dc4a4c Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Wed, 18 Apr 2007 07:34:49 +0000 Subject: [PATCH] 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 --- src/preferences/mouse/MouseWindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/preferences/mouse/MouseWindow.cpp b/src/preferences/mouse/MouseWindow.cpp index 4cb9c1d808..445140959f 100644 --- a/src/preferences/mouse/MouseWindow.cpp +++ b/src/preferences/mouse/MouseWindow.cpp @@ -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)