dwm-meillo
view bar.c @ 58:1269bd127551
made barclick to select the specific tag
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 10:34:07 +0200 |
parents | f005d46462e8 |
children | 50450aa24a46 |
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);
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 if(i == tsel) {
35 swap((void **)&dc.fg, (void **)&dc.bg);
36 drawtext(tags[i], True);
37 swap((void **)&dc.fg, (void **)&dc.bg);
38 }
39 else
40 drawtext(tags[i], True);
41 }
42 if(sel) {
43 swap((void **)&dc.fg, (void **)&dc.bg);
44 dc.x += dc.w;
45 dc.w = textw(sel->name) + dc.font.height;
46 drawtext(sel->name, True);
47 swap((void **)&dc.fg, (void **)&dc.bg);
48 }
49 dc.w = textw(stext) + dc.font.height;
50 dc.x = bx + bw - dc.w;
51 drawtext(stext, False);
52 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
53 XFlush(dpy);
54 }