summaryrefslogtreecommitdiffstats
path: root/MemorySwapMeter.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-09-10 15:28:42 +0200
committerBenBE <BenBE@geshi.org>2021-09-10 17:09:48 +0200
commit8f259bc5e1b9a6a95c16b971cf4733cf76725c96 (patch)
tree8f1571bc43090a30dbbe13f6062fbb8e0604aee3 /MemorySwapMeter.c
parent38e6136b82df583ce59ccc580bf5561c52bc85db (diff)
MemorySwapMeter: align with CPU meter
Use the same width for each sub meter to align with CPU meter. Currently if the total width is even, so it does not split exactly into 2 equal parts plus 1 (for the middle space character column), the extra column is added to the second meter width. Closes: #783
Diffstat (limited to 'MemorySwapMeter.c')
-rw-r--r--MemorySwapMeter.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/MemorySwapMeter.c b/MemorySwapMeter.c
index b653cf21..ffd57331 100644
--- a/MemorySwapMeter.c
+++ b/MemorySwapMeter.c
@@ -33,10 +33,14 @@ static void MemorySwapMeter_updateValues(Meter* this) {
static void MemorySwapMeter_draw(Meter* this, int x, int y, int w) {
MemorySwapMeterData* data = this->meterData;
+ /* Use the same width for each sub meter to align with CPU meter */
+ const int colwidth = w / 2;
+ const int diff = w - colwidth * 2;
+
assert(data->memoryMeter->draw);
- data->memoryMeter->draw(data->memoryMeter, x, y, w / 2);
+ data->memoryMeter->draw(data->memoryMeter, x, y, colwidth);
assert(data->swapMeter->draw);
- data->swapMeter->draw(data->swapMeter, x + w / 2, y, w - w / 2);
+ data->swapMeter->draw(data->swapMeter, x + colwidth + diff, y, colwidth);
}
static void MemorySwapMeter_init(Meter* this) {

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