diff options
author | Anselm R. Garbe <arg@10kloc.org> | 2006-08-24 11:47:08 +0200 |
---|---|---|
committer | Anselm R. Garbe <arg@10kloc.org> | 2006-08-24 11:47:08 +0200 |
commit | e980c7ff1814b533f674eec535af6c5658b1bc62 (patch) | |
tree | 178d0389a8d9e203cac609373fe6f7bf360e4530 /draw.c | |
parent | 7848b53dc3c8c05bd2cf1f10d59db2310456acf7 (diff) |
migrated dmenu to use 4 instead of 3 colors
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -24,7 +24,7 @@ textnw(const char *text, unsigned int len) /* extern */ void -drawtext(const char *text, Bool invert, Bool border) +drawtext(const char *text, unsigned int colidx, Bool border) { int x, y, w, h; static char buf[256]; @@ -33,10 +33,11 @@ drawtext(const char *text, Bool invert, Bool border) XPoint points[5]; XRectangle r = { dc.x, dc.y, dc.w, dc.h }; - XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); + XSetForeground(dpy, dc.gc, dc.bg[colidx]); XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); w = 0; + XSetForeground(dpy, dc.gc, dc.fg[colidx]); if(border) { points[0].x = dc.x; points[0].y = dc.y; @@ -48,7 +49,6 @@ drawtext(const char *text, Bool invert, Bool border) points[3].y = 0; points[4].x = 0; points[4].y = -(dc.h - 1); - XSetForeground(dpy, dc.gc, dc.border); XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); } @@ -80,17 +80,12 @@ drawtext(const char *text, Bool invert, Bool border) if(w > dc.w) return; /* too long */ - gcv.foreground = invert ? dc.bg : dc.fg; - gcv.background = invert ? dc.fg : dc.bg; - if(dc.font.set) { - XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); - XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, - x, y, buf, len); - } + if(dc.font.set) + XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); else { gcv.font = dc.font.xfont->fid; - XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); - XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); + XChangeGC(dpy, dc.gc, GCFont, &gcv); + XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); } } |