mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 12:05:45 +00:00
awesomebar: refactoring remainder logic, which seemed a bit off
This commit is contained in:
parent
474c91ea0c
commit
1d8aef2198
13
dwm.c
13
dwm.c
@ -1827,8 +1827,8 @@ drawbar(Monitor *m)
|
|||||||
#if AWESOMEBAR_PATCH
|
#if AWESOMEBAR_PATCH
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
remainder = w % n;
|
remainder = w % n;
|
||||||
tabw = (1.0 / (double)n) * w + 1;
|
tabw = w / n;
|
||||||
for (c = m->clients; c; c = c->next) {
|
for (i = 0, c = m->clients; c; c = c->next, i++) {
|
||||||
if (!ISVISIBLE(c))
|
if (!ISVISIBLE(c))
|
||||||
continue;
|
continue;
|
||||||
if (m->sel == c)
|
if (m->sel == c)
|
||||||
@ -1849,15 +1849,10 @@ drawbar(Monitor *m)
|
|||||||
#endif // VTCOLORS_PATCH
|
#endif // VTCOLORS_PATCH
|
||||||
|
|
||||||
drw_setscheme(drw, scheme[scm]);
|
drw_setscheme(drw, scheme[scm]);
|
||||||
if (remainder >= 0) {
|
|
||||||
if (remainder == 0)
|
|
||||||
tabw--;
|
|
||||||
remainder--;
|
|
||||||
}
|
|
||||||
#if PANGO_PATCH
|
#if PANGO_PATCH
|
||||||
drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0, False);
|
drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, lrpad / 2, c->name, 0, False);
|
||||||
#else
|
#else
|
||||||
drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0);
|
drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, lrpad / 2, c->name, 0);
|
||||||
#endif // PANGO_PATCH
|
#endif // PANGO_PATCH
|
||||||
x += tabw;
|
x += tabw;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user