annotate bar.c @ 72:d0eb0bb63c40

I prefer the tiled/floating indicator on the right side
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 18:59:25 +0200
parents 7681ef838201
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
1 /*
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
3 * See LICENSE file for license details.
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
4 */
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
5
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
6 #include "dwm.h"
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
7
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
8 void
58
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
9 barclick(XButtonPressedEvent *e)
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
10 {
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
11 int x = 0;
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
12 Arg a;
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
13 for(a.i = 0; a.i < TLast; a.i++) {
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
14 x += textw(tags[a.i]) + dc.font.height;
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
15 if(e->x < x) {
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
16 view(&a);
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
17 return;
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
18 }
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
19 }
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
20 }
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
21
1269bd127551 made barclick to select the specific tag
Anselm R. Garbe <garbeam@wmii.de>
parents: 57
diff changeset
22 void
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
23 draw_bar()
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
24 {
72
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
25 int i, modw;
71
7681ef838201 bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents: 66
diff changeset
26 char *mode = arrange == tiling ? "#" : "~";
7681ef838201 bar shows if currently is tiled (Mod1-space) or floating (Mod1-Shift-space) mode
Anselm R. Garbe <garbeam@wmii.de>
parents: 66
diff changeset
27
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
28 dc.x = dc.y = 0;
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
29 dc.w = bw;
66
50450aa24a46 removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents: 58
diff changeset
30 drawtext(NULL, False, False);
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
31
72
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
32 modw = textw(mode) + dc.font.height;
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
33 dc.w = 0;
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
34 for(i = 0; i < TLast; i++) {
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
35 dc.x += dc.w;
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
36 dc.w = textw(tags[i]) + dc.font.height;
66
50450aa24a46 removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents: 58
diff changeset
37 drawtext(tags[i], i == tsel, True);
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
38 }
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
39 if(sel) {
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
40 dc.x += dc.w;
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
41 dc.w = textw(sel->name) + dc.font.height;
66
50450aa24a46 removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents: 58
diff changeset
42 drawtext(sel->name, True, True);
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
43 }
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
44 dc.w = textw(stext) + dc.font.height;
72
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
45 dc.x = bx + bw - dc.w - modw;
66
50450aa24a46 removed a bunch of lines through swap removal
Anselm R. Garbe <garbeam@wmii.de>
parents: 58
diff changeset
46 drawtext(stext, False, False);
72
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
47
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
48 dc.x = bx + bw - modw;
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
49 dc.w = modw;
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
50 drawtext(mode, True, True);
d0eb0bb63c40 I prefer the tiled/floating indicator on the right side
Anselm R. Garbe <garbeam@wmii.de>
parents: 71
diff changeset
51
57
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
52 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
53 XFlush(dpy);
f005d46462e8 implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
54 }