Fixed normal window size issue for on system with more than 2 CPUs: saved normal window rect can't be

taken as-is from a previous launch time, as number of CPUs could have changed since last boot.
Size is now enforced and height is always dynamically computed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23785 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2008-01-30 04:11:27 +00:00
parent a9f2290ede
commit 2ac009f9d6
2 changed files with 25 additions and 4 deletions
+23 -4
View File
@@ -42,7 +42,11 @@ Prefs::Prefs()
fatalerror = true; fatalerror = true;
return; return;
} }
// While normal window position is under user control, size is not.
// Width is fixed and height must be dynamically computed each time,
// as number of CPUs could change since boot.
ComputeNormalWindowSize();
r = GetMiniWindowRect(); r = GetMiniWindowRect();
if (!GetRect("mini_window_rect", &mini_window_rect, &r)) { if (!GetRect("mini_window_rect", &mini_window_rect, &r)) {
fatalerror = true; fatalerror = true;
@@ -121,8 +125,8 @@ Prefs::~Prefs()
} }
BRect float
Prefs::GetNormalWindowRect() Prefs::GetNormalWindowHeight()
{ {
system_info sys_info; system_info sys_info;
get_system_info(&sys_info); get_system_info(&sys_info);
@@ -131,8 +135,23 @@ Prefs::GetNormalWindowRect()
if (PULSEVIEW_MIN_HEIGHT > height) if (PULSEVIEW_MIN_HEIGHT > height)
height = PULSEVIEW_MIN_HEIGHT; height = PULSEVIEW_MIN_HEIGHT;
return height;
}
void
Prefs::ComputeNormalWindowSize()
{
normal_window_rect.right = normal_window_rect.left + PULSEVIEW_WIDTH;
normal_window_rect.bottom = normal_window_rect.top + GetNormalWindowHeight();
}
BRect
Prefs::GetNormalWindowRect()
{
// Dock the window in the lower right hand corner just like the original // Dock the window in the lower right hand corner just like the original
BRect r(0, 0, PULSEVIEW_WIDTH, height); BRect r(0, 0, PULSEVIEW_WIDTH, GetNormalWindowHeight());
BRect screen_rect = BScreen(B_MAIN_SCREEN_ID).Frame(); BRect screen_rect = BScreen(B_MAIN_SCREEN_ID).Frame();
r.OffsetTo(screen_rect.right - r.Width() - 5, screen_rect.bottom - r.Height() - 5); r.OffsetTo(screen_rect.right - r.Width() - 5, screen_rect.bottom - r.Height() - 5);
return r; return r;
+2
View File
@@ -38,6 +38,8 @@ class Prefs {
bool PutBool(char *name, bool *value); bool PutBool(char *name, bool *value);
bool PutRect(char *name, BRect *value); bool PutRect(char *name, BRect *value);
float GetNormalWindowHeight();
void ComputeNormalWindowSize();
BRect GetNormalWindowRect(); BRect GetNormalWindowRect();
BRect GetMiniWindowRect(); BRect GetMiniWindowRect();
}; };