sync updated drw code from dmenu

important:
- drw_rect: didn't use w and h, change the dwm code accordingly.
- drw_text: text is NULL is not allowed, use drw_rect().
This commit is contained in:
Hiltjo Posthuma
2015-10-20 23:34:49 +02:00
parent e3b7e1d620
commit 646b351cc7
5 changed files with 165 additions and 159 deletions

10
dwm.c
View File

@ -689,10 +689,12 @@ dirtomon(int dir) {
void
drawbar(Monitor *m) {
int x, xx, w;
int x, xx, w, dx;
unsigned int i, occ = 0, urg = 0;
Client *c;
dx = (drw->fonts[0]->ascent + drw->fonts[0]->descent + 2) / 4;
for(c = m->clients; c; c = c->next) {
occ |= c->tags;
if(c->isurgent)
@ -703,7 +705,7 @@ drawbar(Monitor *m) {
w = TEXTW(tags[i]);
drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
drw_rect(drw, x + 1, 1, dx, dx, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
occ & 1 << i, urg & 1 << i);
x += w;
}
@ -728,11 +730,11 @@ drawbar(Monitor *m) {
if(m->sel) {
drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, m->sel->name, 0);
drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0);
drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating, 0);
}
else {
drw_setscheme(drw, &scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, NULL, 0);
drw_rect(drw, x, 0, w, bh, 1, 0, 1);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);