dwm/bar.c

42 lines
977 B
C
Raw Normal View History

2006-07-10 16:16:48 -04:00
/*
* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
* See LICENSE file for license details.
*/
#include "wm.h"
void
draw_bar()
{
2006-07-12 19:04:38 -04:00
int i;
brush.x = brush.y = 0;
brush.w = bw;
brush.h = bh;
2006-07-11 12:53:41 -04:00
draw(dpy, &brush, False, NULL);
2006-07-12 19:04:38 -04:00
brush.w = 0;
for(i = 0; i < TLast; i++) {
brush.x += brush.w;
brush.w = textw(&brush.font, tags[i]) + bh;
if(i == tsel) {
swap((void **)&brush.fg, (void **)&brush.bg);
draw(dpy, &brush, True, tags[i]);
swap((void **)&brush.fg, (void **)&brush.bg);
}
else
draw(dpy, &brush, True, tags[i]);
}
2006-07-11 12:53:41 -04:00
if(stack) {
swap((void **)&brush.fg, (void **)&brush.bg);
2006-07-12 19:04:38 -04:00
brush.x += brush.w;
brush.w = textw(&brush.font, stack->name) + bh;
draw(dpy, &brush, True, stack->name);
2006-07-11 12:53:41 -04:00
swap((void **)&brush.fg, (void **)&brush.bg);
}
2006-07-12 19:04:38 -04:00
brush.w = textw(&brush.font, stext) + bh;
brush.x = bx + bw - brush.w;
2006-07-12 19:04:38 -04:00
draw(dpy, &brush, False, stext);
XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0);
2006-07-10 16:16:48 -04:00
XFlush(dpy);
}