annotate bar.c @ 31:386649deb651

before leaning things up
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 01:04:38 +0200
parents e8f627998d6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
1 /*
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
3 * See LICENSE file for license details.
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
4 */
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
6 #include "wm.h"
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
7
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
8 void
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
9 draw_bar()
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
10 {
31
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
11 int i;
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 22
diff changeset
12 brush.x = brush.y = 0;
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 22
diff changeset
13 brush.w = bw;
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 22
diff changeset
14 brush.h = bh;
16
359b6e563b95 several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 14
diff changeset
15 draw(dpy, &brush, False, NULL);
359b6e563b95 several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 14
diff changeset
16
31
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
17 brush.w = 0;
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
18 for(i = 0; i < TLast; i++) {
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
19 brush.x += brush.w;
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
20 brush.w = textw(&brush.font, tags[i]) + bh;
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
21 if(i == tsel) {
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
22 swap((void **)&brush.fg, (void **)&brush.bg);
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
23 draw(dpy, &brush, True, tags[i]);
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
24 swap((void **)&brush.fg, (void **)&brush.bg);
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
25 }
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
26 else
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
27 draw(dpy, &brush, True, tags[i]);
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
28 }
16
359b6e563b95 several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 14
diff changeset
29 if(stack) {
359b6e563b95 several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 14
diff changeset
30 swap((void **)&brush.fg, (void **)&brush.bg);
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 22
diff changeset
31 brush.x += brush.w;
31
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
32 brush.w = textw(&brush.font, stack->name) + bh;
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
33 draw(dpy, &brush, True, stack->name);
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
34 swap((void **)&brush.fg, (void **)&brush.bg);
16
359b6e563b95 several changes, new stuff
Anselm R. Garbe <garbeam@wmii.de>
parents: 14
diff changeset
35 }
31
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
36 brush.w = textw(&brush.font, stext) + bh;
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 22
diff changeset
37 brush.x = bx + bw - brush.w;
31
386649deb651 before leaning things up
Anselm R. Garbe <garbeam@wmii.de>
parents: 26
diff changeset
38 draw(dpy, &brush, False, stext);
26
e8f627998d6f simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Anselm R. Garbe <garbeam@wmii.de>
parents: 22
diff changeset
39 XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0);
5
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
40 XFlush(dpy);
e5018cae273f added several other stuff
Anselm R. Garbe <garbeam@wmii.de>
parents:
diff changeset
41 }