From 2e834e941f695481894123e0665416f96333653b Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Thu, 24 Aug 2006 09:25:10 +0200 Subject: changing tag indicator through underline --- draw.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index cbf65020..4ebda125 100644 --- a/draw.c +++ b/draw.c @@ -22,9 +22,17 @@ textnw(const char *text, unsigned int len) } static void -drawborder() +drawtext(const char *text, Bool invert, Bool underline) { + int x, y, w, h; + static char buf[256]; + unsigned int len, olen; + XGCValues gcv; XPoint points[5]; + XRectangle r = { dc.x, dc.y, dc.w, dc.h }; + + XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); + XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); points[0].x = dc.x; points[0].y = dc.y; points[1].x = dc.w - 1; @@ -35,24 +43,8 @@ drawborder() points[3].y = 0; points[4].x = 0; points[4].y = -(dc.h - 1); - XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); -} - -static void -drawtext(const char *text, Bool invert, Bool highlight) -{ - int x, y, w, h; - static char buf[256]; - unsigned int len, olen; - DC tmp; - XGCValues gcv; - XRectangle r = { dc.x, dc.y, dc.w, dc.h }; - - XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); - XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); - XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); XSetForeground(dpy, dc.gc, dc.border); - drawborder(); + XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); if(!text) return; @@ -93,14 +85,12 @@ drawtext(const char *text, Bool invert, Bool highlight) XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); } - if(highlight) { - tmp = dc; - dc.x += 2; - dc.y += 2; - dc.w -= 4; - dc.h -= 4; - drawborder(); - dc = tmp; + if(underline) { + points[0].x = dc.x + (h / 2) - 1; + points[0].y = dc.y + dc.h - 3; + points[1].x = dc.w - h + 2; + points[1].y = 0; + XDrawLines(dpy, dc.drawable, dc.gc, points, 2, CoordModePrevious); } } -- cgit v1.2.3