From 2ac009f9d6c59899edf76f75cbf25695ab169ceb Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Wed, 30 Jan 2008 04:11:27 +0000 Subject: [PATCH] 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 --- src/apps/pulse/Prefs.cpp | 27 +++++++++++++++++++++++---- src/apps/pulse/Prefs.h | 2 ++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/apps/pulse/Prefs.cpp b/src/apps/pulse/Prefs.cpp index aed79bb7dd..d1d08eb913 100644 --- a/src/apps/pulse/Prefs.cpp +++ b/src/apps/pulse/Prefs.cpp @@ -42,7 +42,11 @@ Prefs::Prefs() fatalerror = true; 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(); if (!GetRect("mini_window_rect", &mini_window_rect, &r)) { fatalerror = true; @@ -121,8 +125,8 @@ Prefs::~Prefs() } -BRect -Prefs::GetNormalWindowRect() +float +Prefs::GetNormalWindowHeight() { system_info sys_info; get_system_info(&sys_info); @@ -131,8 +135,23 @@ Prefs::GetNormalWindowRect() if (PULSEVIEW_MIN_HEIGHT > 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 - BRect r(0, 0, PULSEVIEW_WIDTH, height); + BRect r(0, 0, PULSEVIEW_WIDTH, GetNormalWindowHeight()); BRect screen_rect = BScreen(B_MAIN_SCREEN_ID).Frame(); r.OffsetTo(screen_rect.right - r.Width() - 5, screen_rect.bottom - r.Height() - 5); return r; diff --git a/src/apps/pulse/Prefs.h b/src/apps/pulse/Prefs.h index 1dff0cde34..b5e1f8d710 100644 --- a/src/apps/pulse/Prefs.h +++ b/src/apps/pulse/Prefs.h @@ -38,6 +38,8 @@ class Prefs { bool PutBool(char *name, bool *value); bool PutRect(char *name, BRect *value); + float GetNormalWindowHeight(); + void ComputeNormalWindowSize(); BRect GetNormalWindowRect(); BRect GetMiniWindowRect(); };