diff --git a/src/apps/processcontroller/PCWindow.cpp b/src/apps/processcontroller/PCWindow.cpp index 0baedeeeba..2389259ea4 100644 --- a/src/apps/processcontroller/PCWindow.cpp +++ b/src/apps/processcontroller/PCWindow.cpp @@ -29,7 +29,17 @@ PCWindow::PCWindow() preferences.SaveInt32(kCurrentVersion, kVersionName); preferences.LoadWindowPosition(this, kPosPrefName); - SetSizeLimits(Bounds().Width(), Bounds().Width(), 31, 32767); + system_info info; + get_system_info(&info); + int width = 15; + if (info.cpu_count > 4) + width = info.cpu_count; + if (info.cpu_count <= 16) + width *= 2; + + // For the memory bar + width += 8; + BRect rect = Bounds(); BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW); @@ -38,8 +48,11 @@ PCWindow::PCWindow() // set up a rectangle && instantiate a new view // view rect should be same size as window rect but with left top at (0, 0) - rect.Set(0, 0, 15, 15); + rect.Set(0, 0, width, 15); + SetSizeLimits(rect.Width() + 21, rect.Width() + 21, 15 + 21, 15 + 21); + rect.OffsetTo((Bounds().Width() - 16) / 2, (Bounds().Height() - 16) / 2); + topView->AddChild(new ProcessController(rect)); // make window visible diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index 657bcb9a22..5c56d7ddec 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -117,14 +117,6 @@ layoutT layout[] = { { 3, 1, 4 }, // 2 { 2, 1, 3 }, { 2, 0, 3 }, // 4 - { 1, 1, 1 }, - { 1, 1, 2 }, - { 1, 1, 1 }, - { 1, 0, 3 }, // 8 - { 1, 1, 1 }, - { 1, 0, 3 }, - { 1, 0, 2 }, - { 1, 0, 1 } // 12 }; @@ -135,7 +127,23 @@ extern "C" _EXPORT BView* instantiate_deskbar_item(float maxWidth, float maxHeight) { gInDeskbar = true; - return new ProcessController(maxHeight - 1, maxHeight - 1); + + system_info info; + get_system_info(&info); + int width = 15; + if (info.cpu_count > 4) + width = info.cpu_count; + if (info.cpu_count <= 16) + width *= 2; + + // For the memory bar + width += 8; + + // Damn, you got a lot of CPU + if (width > maxWidth) + width = maxWidth; + + return new ProcessController(width - 1, maxHeight - 1); } @@ -600,8 +608,8 @@ ProcessController::DoDraw(bool force) float barWidth; float barGap; float memWidth; - if (gCPUcount <= 12 && bounds.Width() == 15) { - // Use fixed sizes for small icon sizes + if (gCPUcount <= 4 && bounds.Width() == 15) { + // Use fixed sizes for small CPU counts barWidth = layout[gCPUcount].cpu_width; barGap = layout[gCPUcount].cpu_inter; memWidth = layout[gCPUcount].mem_width;