MouseSettings::RetrieveSettings() promised that the window will filter
invalid coordinates and center the window on screen. Now, that really happens, and the MouseSettings class will also have a default value for the position that triggers this behaviour as well. Thanks to voidref for reporting this. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5983 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -38,6 +38,8 @@ static const int32 kDefaultAccelerationFactor = 65536;
|
||||
|
||||
|
||||
MouseSettings::MouseSettings()
|
||||
:
|
||||
fWindowPosition(-1, -1)
|
||||
{
|
||||
RetrieveSettings();
|
||||
|
||||
|
||||
@@ -62,8 +62,22 @@ MouseWindow::MouseWindow(BRect rect)
|
||||
// we are using the pulse rate to scan pressed mouse
|
||||
// buttons and draw the selected imagery
|
||||
|
||||
ResizeTo(fSettingsView->Frame().right + kBorderSpace, button->Frame().bottom + kBorderSpace - 1);
|
||||
MoveTo(fSettings.WindowPosition());
|
||||
ResizeTo(fSettingsView->Frame().right + kBorderSpace,
|
||||
button->Frame().bottom + kBorderSpace - 1);
|
||||
|
||||
// check if the window is on screen
|
||||
|
||||
rect = BScreen().Frame();
|
||||
rect.right -= 20;
|
||||
rect.bottom -= 20;
|
||||
|
||||
BPoint position = fSettings.WindowPosition();
|
||||
if (!rect.Contains(position)) {
|
||||
// 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;
|
||||
}
|
||||
MoveTo(position);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user