JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
before leaning things up
[dwm.git] / bar.c
1 /*
2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3  * See LICENSE file for license details.
4  */
5
6 #include "wm.h"
7
8 void
9 draw_bar()
10 {
11         int i;
12         brush.x = brush.y = 0;
13         brush.w = bw;
14         brush.h = bh;
15         draw(dpy, &brush, False, NULL);
16
17         brush.w = 0;
18         for(i = 0; i < TLast; i++) {
19                 brush.x += brush.w;
20                 brush.w = textw(&brush.font, tags[i]) + bh;
21                 if(i == tsel) {
22                         swap((void **)&brush.fg, (void **)&brush.bg);
23                         draw(dpy, &brush, True, tags[i]);
24                         swap((void **)&brush.fg, (void **)&brush.bg);
25                 }
26                 else
27                         draw(dpy, &brush, True, tags[i]);
28         }
29         if(stack) {
30                 swap((void **)&brush.fg, (void **)&brush.bg);
31                 brush.x += brush.w;
32                 brush.w = textw(&brush.font, stack->name) + bh;
33                 draw(dpy, &brush, True, stack->name);
34                 swap((void **)&brush.fg, (void **)&brush.bg);
35         }
36         brush.w = textw(&brush.font, stext) + bh;
37         brush.x = bx + bw - brush.w;
38         draw(dpy, &brush, False, stext);
39         XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0);
40         XFlush(dpy);
41 }