From 64e0d9452da6f8f4daa000fbeacbea9e36d162aa Mon Sep 17 00:00:00 2001 From: Valmiky Arquissandas Date: Tue, 14 Oct 2014 02:30:17 +0100 Subject: [PATCH] Added new color for 'D' state. --- CRT.c | 7 +++++++ CRT.h | 1 + Process.c | 13 ++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CRT.c b/CRT.c index edd54817..14a30d0f 100644 --- a/CRT.c +++ b/CRT.c @@ -67,6 +67,7 @@ typedef enum ColorElements_ { PROCESS_MEGABYTES, PROCESS_TREE, PROCESS_R_STATE, + PROCESS_D_STATE, PROCESS_BASENAME, PROCESS_HIGH_PRIORITY, PROCESS_LOW_PRIORITY, @@ -280,6 +281,7 @@ void CRT_setColors(int colorScheme) { CRT_colors[PROCESS_BASENAME] = A_BOLD; CRT_colors[PROCESS_TREE] = A_BOLD; CRT_colors[PROCESS_R_STATE] = A_BOLD; + CRT_colors[PROCESS_D_STATE] = A_BOLD; CRT_colors[PROCESS_HIGH_PRIORITY] = A_BOLD; CRT_colors[PROCESS_LOW_PRIORITY] = A_DIM; CRT_colors[PROCESS_THREAD] = A_BOLD; @@ -343,6 +345,7 @@ void CRT_setColors(int colorScheme) { CRT_colors[PROCESS_BASENAME] = ColorPair(Blue,White); CRT_colors[PROCESS_TREE] = ColorPair(Green,White); CRT_colors[PROCESS_R_STATE] = ColorPair(Green,White); + CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,White); CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,White); CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,White); CRT_colors[PROCESS_THREAD] = ColorPair(Blue,White); @@ -406,6 +409,7 @@ void CRT_setColors(int colorScheme) { CRT_colors[PROCESS_BASENAME] = ColorPair(Green,Black); CRT_colors[PROCESS_TREE] = ColorPair(Blue,Black); CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black); + CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black); CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black); CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black); CRT_colors[PROCESS_THREAD] = ColorPair(Blue,Black); @@ -469,6 +473,7 @@ void CRT_setColors(int colorScheme) { CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Blue); CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Blue); CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Blue); + CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Blue); CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Blue); CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Blue); CRT_colors[PROCESS_THREAD] = ColorPair(Green,Blue); @@ -534,6 +539,7 @@ void CRT_setColors(int colorScheme) { CRT_colors[PROCESS_THREAD] = ColorPair(Green,Black); CRT_colors[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black); CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black); + CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black); CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black); CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black); CRT_colors[BAR_BORDER] = A_BOLD | ColorPair(Green,Black); @@ -596,6 +602,7 @@ void CRT_setColors(int colorScheme) { CRT_colors[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black); CRT_colors[PROCESS_TREE] = ColorPair(Cyan,Black); CRT_colors[PROCESS_R_STATE] = ColorPair(Green,Black); + CRT_colors[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black); CRT_colors[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black); CRT_colors[PROCESS_LOW_PRIORITY] = ColorPair(Red,Black); CRT_colors[PROCESS_THREAD] = ColorPair(Green,Black); diff --git a/CRT.h b/CRT.h index 883c675a..260d0874 100644 --- a/CRT.h +++ b/CRT.h @@ -58,6 +58,7 @@ typedef enum ColorElements_ { PROCESS_MEGABYTES, PROCESS_TREE, PROCESS_R_STATE, + PROCESS_D_STATE, PROCESS_BASENAME, PROCESS_HIGH_PRIORITY, PROCESS_LOW_PRIORITY, diff --git a/Process.c b/Process.c index 757b7402..a4680ff3 100644 --- a/Process.c +++ b/Process.c @@ -533,9 +533,16 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel } case STATE: { snprintf(buffer, n, "%c ", this->state); - attr = this->state == 'R' - ? CRT_colors[PROCESS_R_STATE] - : attr; + switch(this->state) { + case 'R': + attr = CRT_colors[PROCESS_R_STATE]; + break; + case 'D': + attr = CRT_colors[PROCESS_D_STATE]; + break; + default: + attr = this->state; + } break; } case PRIORITY: {