From 25feff2c29fddb8ba75323b2af9b2d7011fa78e7 Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Thu, 12 Dec 2013 21:46:48 +0100 Subject: [PATCH] ProcessController: Explicitly check thread priority --- src/apps/processcontroller/ThreadBarMenuItem.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/apps/processcontroller/ThreadBarMenuItem.cpp b/src/apps/processcontroller/ThreadBarMenuItem.cpp index 8af186b7ad..94b2d1dd8c 100644 --- a/src/apps/processcontroller/ThreadBarMenuItem.cpp +++ b/src/apps/processcontroller/ThreadBarMenuItem.cpp @@ -104,10 +104,16 @@ ThreadBarMenuItem::DrawBar(bool force) r.right = fGrenze1; } if (r.left < r.right) { - if (selected) - menu->SetHighColor(fThreadID <= gCPUcount ? gIdleColorSelected : gUserColorSelected); - else - menu->SetHighColor(fThreadID <= gCPUcount ? gIdleColor : gUserColor); + thread_info threadInfo; + bool idleThread = false; + if (get_thread_info(fThreadID, &threadInfo) == B_OK) + idleThread = threadInfo.priority == B_IDLE_PRIORITY; + + if (selected) { + menu->SetHighColor( + idleThread ? gIdleColorSelected : gUserColorSelected); + } else + menu->SetHighColor(idleThread ? gIdleColor : gUserColor); menu->FillRect(r); } r.left = grenze2; @@ -157,7 +163,7 @@ ThreadBarMenuItem::BarUpdate() bigtime_t now = system_time(); fKernel = double(info.kernel_time - fThreadInfo.kernel_time) / double(now - fLastTime); fUser = double(info.user_time - fThreadInfo.user_time) / double(now - fLastTime); - if (fThreadID <= gCPUcount) { + if (info.priority == B_IDLE_PRIORITY) { fUser += fKernel; fKernel = 0; }