diff options
author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-14 22:33:38 +0200 |
---|---|---|
committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-14 22:33:38 +0200 |
commit | 29355bd38284ed9aec8d3ffabde61db73947c9f9 (patch) | |
tree | e8c9d94e52b57df9c93bc58bdd5c37b9e3262e65 /draw.c | |
parent | 91a1f6926e2594156219c1caaf4729c5d86498a5 (diff) |
rearranged
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 67 |
1 files changed, 66 insertions, 1 deletions
@@ -10,6 +10,71 @@ #include "dwm.h" +void +draw_bar() +{ + int i; + + dc.x = dc.y = 0; + dc.w = bw; + drawtext(NULL, False, False); + + if(arrange == floating) { + dc.w = textw("~"); + drawtext("~", False, False); + } + else + dc.w = 0; + for(i = 0; i < TLast; i++) { + dc.x += dc.w; + dc.w = textw(tags[i]); + drawtext(tags[i], i == tsel, True); + } + if(sel) { + dc.x += dc.w; + dc.w = textw(sel->name); + drawtext(sel->name, True, True); + } + dc.w = textw(stext); + dc.x = bx + bw - dc.w; + drawtext(stext, False, False); + + XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); + XFlush(dpy); +} + +void +draw_client(Client *c) +{ + int i; + if(c == sel) { + draw_bar(); + XUnmapWindow(dpy, c->title); + XSetWindowBorder(dpy, c->win, dc.fg); + return; + } + + XSetWindowBorder(dpy, c->win, dc.bg); + XMapWindow(dpy, c->title); + + dc.x = dc.y = 0; + + dc.w = 0; + for(i = 0; i < TLast; i++) { + if(c->tags[i]) { + dc.x += dc.w; + dc.w = textw(c->tags[i]); + drawtext(c->tags[i], False, True); + } + } + dc.x += dc.w; + dc.w = textw(c->name); + drawtext(c->name, False, True); + XCopyArea(dpy, dc.drawable, c->title, dc.gc, + 0, 0, c->tw, c->th, 0, 0); + XFlush(dpy); +} + static void drawborder(void) { @@ -103,7 +168,7 @@ textnw(char *text, unsigned int len) unsigned int textw(char *text) { - return textnw(text, strlen(text)); + return textnw(text, strlen(text)) + dc.font.height; } void |