summaryrefslogtreecommitdiffstats
path: root/Meter.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2016-03-11 10:54:34 +0800
committerExplorer09 <explorer09@gmail.com>2016-03-11 10:54:34 +0800
commit99fb3070a2bcbb8cc2956c360f5922bfde6e233e (patch)
treed4fec9e91fd0bf927be5ece6a07ba3df981c3dfd /Meter.c
parent7d3f67e8223168f1da4f82f928029056f74ad651 (diff)
Explicit "maxItems" property of meters
Two changes in this commit: - All meters now explicitly specify "maxItems" property, even for just 1 item. (Exception is "container" CPU meter classes, which use CUSTOM_METERMODE.) - "maxItems" being 0 is now allowed. This will let bar meters and graph meters render an empty meter.
Diffstat (limited to 'Meter.c')
-rw-r--r--Meter.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Meter.c b/Meter.c
index 9a7868e7..321fd28b 100644
--- a/Meter.c
+++ b/Meter.c
@@ -132,12 +132,8 @@ Meter* Meter_new(struct ProcessList_* pl, int param, MeterClass* type) {
this->h = 1;
this->param = param;
this->pl = pl;
- char maxItems = type->maxItems;
- if (maxItems == 0) {
- maxItems = 1;
- }
- type->curItems = maxItems;
- this->values = xCalloc(maxItems, sizeof(double));
+ type->curItems = type->maxItems;
+ this->values = xCalloc(type->maxItems, sizeof(double));
this->total = type->total;
this->caption = xStrdup(type->caption);
if (Meter_initFn(this))
@@ -550,6 +546,7 @@ MeterClass BlankMeter_class = {
},
.setValues = BlankMeter_setValues,
.defaultMode = TEXT_METERMODE,
+ .maxItems = 0,
.total = 100.0,
.attributes = BlankMeter_attributes,
.name = "Blank",

© 2014-2024 Faster IT GmbH | imprint | privacy policy