annotate bar.c @ 57:f005d46462e8
implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
author |
Anselm R. Garbe <garbeam@wmii.de> |
date |
Fri, 14 Jul 2006 10:07:38 +0200 |
parents |
|
children |
1269bd127551 |
rev |
line source |
garbeam@57
|
1 /*
|
garbeam@57
|
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
garbeam@57
|
3 * See LICENSE file for license details.
|
garbeam@57
|
4 */
|
garbeam@57
|
5
|
garbeam@57
|
6 #include "dwm.h"
|
garbeam@57
|
7
|
garbeam@57
|
8 void
|
garbeam@57
|
9 draw_bar()
|
garbeam@57
|
10 {
|
garbeam@57
|
11 int i;
|
garbeam@57
|
12 dc.x = dc.y = 0;
|
garbeam@57
|
13 dc.w = bw;
|
garbeam@57
|
14 drawtext(NULL, False);
|
garbeam@57
|
15
|
garbeam@57
|
16 dc.w = 0;
|
garbeam@57
|
17 for(i = 0; i < TLast; i++) {
|
garbeam@57
|
18 dc.x += dc.w;
|
garbeam@57
|
19 dc.w = textw(tags[i]) + dc.font.height;
|
garbeam@57
|
20 if(i == tsel) {
|
garbeam@57
|
21 swap((void **)&dc.fg, (void **)&dc.bg);
|
garbeam@57
|
22 drawtext(tags[i], True);
|
garbeam@57
|
23 swap((void **)&dc.fg, (void **)&dc.bg);
|
garbeam@57
|
24 }
|
garbeam@57
|
25 else
|
garbeam@57
|
26 drawtext(tags[i], True);
|
garbeam@57
|
27 }
|
garbeam@57
|
28 if(sel) {
|
garbeam@57
|
29 swap((void **)&dc.fg, (void **)&dc.bg);
|
garbeam@57
|
30 dc.x += dc.w;
|
garbeam@57
|
31 dc.w = textw(sel->name) + dc.font.height;
|
garbeam@57
|
32 drawtext(sel->name, True);
|
garbeam@57
|
33 swap((void **)&dc.fg, (void **)&dc.bg);
|
garbeam@57
|
34 }
|
garbeam@57
|
35 dc.w = textw(stext) + dc.font.height;
|
garbeam@57
|
36 dc.x = bx + bw - dc.w;
|
garbeam@57
|
37 drawtext(stext, False);
|
garbeam@57
|
38 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
|
garbeam@57
|
39 XFlush(dpy);
|
garbeam@57
|
40 }
|