mirror of https://github.com/xzeldon/htop.git
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
This commit is contained in:
parent
38e6136b82
commit
8f259bc5e1
|
@ -33,10 +33,14 @@ static void MemorySwapMeter_updateValues(Meter* this) {
|
||||||
static void MemorySwapMeter_draw(Meter* this, int x, int y, int w) {
|
static void MemorySwapMeter_draw(Meter* this, int x, int y, int w) {
|
||||||
MemorySwapMeterData* data = this->meterData;
|
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);
|
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);
|
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) {
|
static void MemorySwapMeter_init(Meter* this) {
|
||||||
|
|
Loading…
Reference in New Issue