mirror of https://github.com/xzeldon/htop.git
fixed x/y coordinate mixup
This commit is contained in:
parent
7fdd8d3732
commit
b55f9320bc
|
@ -221,10 +221,11 @@ static void MultiColCPUsMeter_draw(Meter* this, int x, int y, int w){
|
||||||
int ncol = MapClassnameToColumncount(this);
|
int ncol = MapClassnameToColumncount(this);
|
||||||
int colwidth = (w-ncol)/ncol + 1;
|
int colwidth = (w-ncol)/ncol + 1;
|
||||||
int diff = (w - (colwidth * ncol));
|
int diff = (w - (colwidth * ncol));
|
||||||
|
int nrows = (count + ncol - 1) / ncol;
|
||||||
for (int i = 0; i < count; i++){
|
for (int i = 0; i < count; i++){
|
||||||
int d = (i%ncol) > diff ? diff : (i % ncol) ; // dynamic spacer
|
int d = (i/nrows) > diff ? diff : (i / nrows) ; // dynamic spacer
|
||||||
int xpos = x + ((i % ncol) * colwidth) + d;
|
int xpos = x + ((i / nrows) * colwidth) + d;
|
||||||
int ypos = y + ((i / ncol) * meters[0]->h);
|
int ypos = y + ((i % nrows) * meters[0]->h);
|
||||||
meters[i]->draw(meters[i], xpos, ypos, colwidth);
|
meters[i]->draw(meters[i], xpos, ypos, colwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue