JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
1f125122695214639acb1dfcaf171d681496926b
[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         brush.rect = barrect;
12         brush.rect.x = brush.rect.y = 0;
13         draw(dpy, &brush, False, NULL);
14
15         if(stack) {
16                 brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font);
17                 swap((void **)&brush.fg, (void **)&brush.bg);
18                 draw(dpy, &brush, True, stack->name);
19                 swap((void **)&brush.fg, (void **)&brush.bg);
20                 brush.rect.x += brush.rect.width;
21         }
22
23         brush.rect.width = textwidth(&brush.font, statustext) + labelheight(&brush.font);
24         brush.rect.x = barrect.x + barrect.width - brush.rect.width;
25         draw(dpy, &brush, False, statustext);
26
27         XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, barrect.width,
28                         barrect.height, 0, 0);
29         XFlush(dpy);
30 }