mirror of https://github.com/xzeldon/htop.git
retain meter state when it is reinit'ed in the Setup screen
This commit is contained in:
parent
b57b7e9a9e
commit
bd459776a4
13
CPUMeter.c
13
CPUMeter.c
|
@ -124,12 +124,15 @@ static void CPUMeter_display(Object* cast, RichString* out) {
|
||||||
|
|
||||||
static void AllCPUsMeter_init(Meter* this) {
|
static void AllCPUsMeter_init(Meter* this) {
|
||||||
int cpus = this->pl->cpuCount;
|
int cpus = this->pl->cpuCount;
|
||||||
this->drawData = malloc(sizeof(Meter*) * cpus);
|
if (!this->drawData)
|
||||||
|
this->drawData = calloc(sizeof(Meter*), cpus);
|
||||||
Meter** meters = (Meter**) this->drawData;
|
Meter** meters = (Meter**) this->drawData;
|
||||||
for (int i = 0; i < cpus; i++)
|
for (int i = 0; i < cpus; i++) {
|
||||||
meters[i] = Meter_new(this->pl, i+1, &CPUMeter);
|
if (!meters[i])
|
||||||
this->h = cpus;
|
meters[i] = Meter_new(this->pl, i+1, &CPUMeter);
|
||||||
this->mode = BAR_METERMODE;
|
meters[i]->type->init(meters[i]);
|
||||||
|
}
|
||||||
|
this->h = Meter_modes[this->mode]->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AllCPUsMeter_done(Meter* this) {
|
static void AllCPUsMeter_done(Meter* this) {
|
||||||
|
|
3
Meter.c
3
Meter.c
|
@ -155,8 +155,9 @@ Meter* Meter_new(ProcessList* pl, int param, MeterType* type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Meter_delete(Object* cast) {
|
void Meter_delete(Object* cast) {
|
||||||
|
if (!cast)
|
||||||
|
return;
|
||||||
Meter* this = (Meter*) cast;
|
Meter* this = (Meter*) cast;
|
||||||
assert (this != NULL);
|
|
||||||
if (this->type->done) {
|
if (this->type->done) {
|
||||||
this->type->done(this);
|
this->type->done(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue