diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:01:07 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:01:07 +0200 |
commit | ff9409b1737627857eb47f64f536a3f66b6a09a4 (patch) | |
tree | 61b631ba551e68a4f656b8b76ff7bd0d9955fc64 /AffinityPanel.c | |
parent | f75ab6d2c11e8a8e18191b087564aedebbeb96c5 (diff) | |
download | debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.tar.gz debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.tar.bz2 debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.zip |
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'AffinityPanel.c')
-rw-r--r-- | AffinityPanel.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/AffinityPanel.c b/AffinityPanel.c index 094a010..03bfa75 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -6,6 +6,7 @@ in the source distribution for its full text. */ #include "AffinityPanel.h" +#include "CRT.h" #include "CheckItem.h" @@ -23,6 +24,7 @@ static HandlerResult AffinityPanel_eventHandler(Panel* this, int ch) { CheckItem* selected = (CheckItem*) Panel_getSelected(this); switch(ch) { case KEY_MOUSE: + case KEY_RECLICK: case ' ': CheckItem_set(selected, ! (CheckItem_get(selected)) ); return HANDLED; @@ -43,14 +45,14 @@ PanelClass AffinityPanel_class = { }; Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity) { - Panel* this = Panel_new(1, 1, 1, 1, true, Class(CheckItem)); + Panel* this = Panel_new(1, 1, 1, 1, true, Class(CheckItem), FunctionBar_newEnterEsc("Set ", "Cancel ")); Object_setClass(this, Class(AffinityPanel)); Panel_setHeader(this, "Use CPUs:"); int curCpu = 0; for (int i = 0; i < pl->cpuCount; i++) { char number[10]; - snprintf(number, 9, "%d", ProcessList_cpuId(pl, i)); + snprintf(number, 9, "%d", Settings_cpuId(pl->settings, i)); bool mode; if (curCpu < affinity->used && affinity->cpus[curCpu] == i) { mode = true; @@ -58,13 +60,13 @@ Panel* AffinityPanel_new(ProcessList* pl, Affinity* affinity) { } else { mode = false; } - Panel_add(this, (Object*) CheckItem_new(strdup(number), NULL, mode)); + Panel_add(this, (Object*) CheckItem_newByVal(xStrdup(number), mode)); } return this; } -Affinity* AffinityPanel_getAffinity(Panel* this) { - Affinity* affinity = Affinity_new(); +Affinity* AffinityPanel_getAffinity(Panel* this, ProcessList* pl) { + Affinity* affinity = Affinity_new(pl); int size = Panel_size(this); for (int i = 0; i < size; i++) { if (CheckItem_get((CheckItem*)Panel_get(this, i))) |