dwm-meillo
view bar.c @ 68:d31b5ad96b0b
prep 0.1
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 18:40:31 +0200 |
parents | 1269bd127551 |
children | 7681ef838201 |
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include "dwm.h"
8 void
9 barclick(XButtonPressedEvent *e)
10 {
11 int x = 0;
12 Arg a;
13 for(a.i = 0; a.i < TLast; a.i++) {
14 x += textw(tags[a.i]) + dc.font.height;
15 if(e->x < x) {
16 view(&a);
17 return;
18 }
19 }
20 }
22 void
23 draw_bar()
24 {
25 int i;
26 dc.x = dc.y = 0;
27 dc.w = bw;
28 drawtext(NULL, False, False);
30 dc.w = 0;
31 for(i = 0; i < TLast; i++) {
32 dc.x += dc.w;
33 dc.w = textw(tags[i]) + dc.font.height;
34 drawtext(tags[i], i == tsel, True);
35 }
36 if(sel) {
37 dc.x += dc.w;
38 dc.w = textw(sel->name) + dc.font.height;
39 drawtext(sel->name, True, True);
40 }
41 dc.w = textw(stext) + dc.font.height;
42 dc.x = bx + bw - dc.w;
43 drawtext(stext, False, False);
44 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
45 XFlush(dpy);
46 }