annotate bar.c @ 71:7681ef838201
bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
author |
Anselm R. Garbe <garbeam@wmii.de> |
date |
Fri, 14 Jul 2006 18:55:50 +0200 |
parents |
50450aa24a46 |
children |
d0eb0bb63c40 |
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@58
|
9 barclick(XButtonPressedEvent *e)
|
garbeam@58
|
10 {
|
garbeam@58
|
11 int x = 0;
|
garbeam@58
|
12 Arg a;
|
garbeam@58
|
13 for(a.i = 0; a.i < TLast; a.i++) {
|
garbeam@58
|
14 x += textw(tags[a.i]) + dc.font.height;
|
garbeam@58
|
15 if(e->x < x) {
|
garbeam@58
|
16 view(&a);
|
garbeam@58
|
17 return;
|
garbeam@58
|
18 }
|
garbeam@58
|
19 }
|
garbeam@58
|
20 }
|
garbeam@58
|
21
|
garbeam@58
|
22 void
|
garbeam@57
|
23 draw_bar()
|
garbeam@57
|
24 {
|
garbeam@57
|
25 int i;
|
garbeam@71
|
26 char *mode = arrange == tiling ? "#" : "~";
|
garbeam@71
|
27
|
garbeam@57
|
28 dc.x = dc.y = 0;
|
garbeam@57
|
29 dc.w = bw;
|
garbeam@66
|
30 drawtext(NULL, False, False);
|
garbeam@57
|
31
|
garbeam@71
|
32 dc.w = textw(mode) + dc.font.height;
|
garbeam@71
|
33 drawtext(mode, True, True);
|
garbeam@71
|
34
|
garbeam@57
|
35 for(i = 0; i < TLast; i++) {
|
garbeam@57
|
36 dc.x += dc.w;
|
garbeam@57
|
37 dc.w = textw(tags[i]) + dc.font.height;
|
garbeam@66
|
38 drawtext(tags[i], i == tsel, True);
|
garbeam@57
|
39 }
|
garbeam@57
|
40 if(sel) {
|
garbeam@57
|
41 dc.x += dc.w;
|
garbeam@57
|
42 dc.w = textw(sel->name) + dc.font.height;
|
garbeam@66
|
43 drawtext(sel->name, True, True);
|
garbeam@57
|
44 }
|
garbeam@57
|
45 dc.w = textw(stext) + dc.font.height;
|
garbeam@57
|
46 dc.x = bx + bw - dc.w;
|
garbeam@66
|
47 drawtext(stext, False, False);
|
garbeam@57
|
48 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
|
garbeam@57
|
49 XFlush(dpy);
|
garbeam@57
|
50 }
|