Mercurial > aewl
comparison draw.c @ 75:f08271b7cb20
rearranged several stuff
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Sat, 15 Jul 2006 16:30:50 +0200 |
parents | 5370ef170cc9 |
children | 4bd49f404f10 |
comparison
equal
deleted
inserted
replaced
74:5370ef170cc9 | 75:f08271b7cb20 |
---|---|
9 #include <X11/Xlocale.h> | 9 #include <X11/Xlocale.h> |
10 | 10 |
11 #include "dwm.h" | 11 #include "dwm.h" |
12 | 12 |
13 void | 13 void |
14 drawall() | |
15 { | |
16 Client *c; | |
17 | |
18 for(c = clients; c; c = getnext(c->next)) | |
19 drawtitle(c); | |
20 drawstatus(); | |
21 } | |
22 | |
23 void | |
14 drawstatus() | 24 drawstatus() |
15 { | 25 { |
16 int i; | 26 int i; |
27 Bool istile = arrange == dotile; | |
17 | 28 |
18 dc.x = dc.y = 0; | 29 dc.x = dc.y = 0; |
19 dc.w = bw; | 30 dc.w = bw; |
20 drawtext(NULL, False, False); | 31 drawtext(NULL, !istile, False); |
21 | 32 |
22 if(arrange == floating) { | 33 dc.w = 0; |
23 dc.w = textw("~"); | |
24 drawtext("~", False, False); | |
25 } | |
26 else | |
27 dc.w = 0; | |
28 for(i = 0; i < TLast; i++) { | 34 for(i = 0; i < TLast; i++) { |
29 dc.x += dc.w; | 35 dc.x += dc.w; |
30 dc.w = textw(tags[i]); | 36 dc.w = textw(tags[i]); |
31 drawtext(tags[i], i == tsel, True); | 37 if(istile) |
38 drawtext(tags[i], (i == tsel), True); | |
39 else | |
40 drawtext(tags[i], (i != tsel), True); | |
32 } | 41 } |
33 if(sel) { | 42 if(sel) { |
34 dc.x += dc.w; | 43 dc.x += dc.w; |
35 dc.w = textw(sel->name); | 44 dc.w = textw(sel->name); |
36 drawtext(sel->name, True, True); | 45 drawtext(sel->name, istile, True); |
37 } | 46 } |
38 dc.w = textw(stext); | 47 dc.w = textw(stext); |
39 dc.x = bx + bw - dc.w; | 48 dc.x = bx + bw - dc.w; |
40 drawtext(stext, False, False); | 49 drawtext(stext, !istile, False); |
41 | 50 |
42 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); | 51 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); |
43 XFlush(dpy); | 52 XFlush(dpy); |
44 } | 53 } |
45 | 54 |
46 void | 55 void |
47 drawtitle(Client *c) | 56 drawtitle(Client *c) |
48 { | 57 { |
49 int i; | 58 int i; |
59 Bool istile = arrange == dotile; | |
60 | |
50 if(c == sel) { | 61 if(c == sel) { |
51 drawstatus(); | 62 drawstatus(); |
52 XUnmapWindow(dpy, c->title); | 63 XUnmapWindow(dpy, c->title); |
53 XSetWindowBorder(dpy, c->win, dc.fg); | 64 XSetWindowBorder(dpy, c->win, dc.fg); |
54 return; | 65 return; |
62 dc.w = 0; | 73 dc.w = 0; |
63 for(i = 0; i < TLast; i++) { | 74 for(i = 0; i < TLast; i++) { |
64 if(c->tags[i]) { | 75 if(c->tags[i]) { |
65 dc.x += dc.w; | 76 dc.x += dc.w; |
66 dc.w = textw(c->tags[i]); | 77 dc.w = textw(c->tags[i]); |
67 drawtext(c->tags[i], False, True); | 78 drawtext(c->tags[i], !istile, True); |
68 } | 79 } |
69 } | 80 } |
70 dc.x += dc.w; | 81 dc.x += dc.w; |
71 dc.w = textw(c->name); | 82 dc.w = textw(c->name); |
72 drawtext(c->name, False, True); | 83 drawtext(c->name, !istile, True); |
73 XCopyArea(dpy, dc.drawable, c->title, dc.gc, | 84 XCopyArea(dpy, dc.drawable, c->title, dc.gc, |
74 0, 0, c->tw, c->th, 0, 0); | 85 0, 0, c->tw, c->th, 0, 0); |
75 XFlush(dpy); | 86 XFlush(dpy); |
76 } | 87 } |
77 | 88 |
213 dc.font.xfont = NULL; | 224 dc.font.xfont = NULL; |
214 dc.font.xfont = XLoadQueryFont(dpy, fontstr); | 225 dc.font.xfont = XLoadQueryFont(dpy, fontstr); |
215 if (!dc.font.xfont) | 226 if (!dc.font.xfont) |
216 dc.font.xfont = XLoadQueryFont(dpy, "fixed"); | 227 dc.font.xfont = XLoadQueryFont(dpy, "fixed"); |
217 if (!dc.font.xfont) | 228 if (!dc.font.xfont) |
218 error("error, cannot init 'fixed' font\n"); | 229 eprint("error, cannot init 'fixed' font\n"); |
219 dc.font.ascent = dc.font.xfont->ascent; | 230 dc.font.ascent = dc.font.xfont->ascent; |
220 dc.font.descent = dc.font.xfont->descent; | 231 dc.font.descent = dc.font.xfont->descent; |
221 } | 232 } |
222 dc.font.height = dc.font.ascent + dc.font.descent; | 233 dc.font.height = dc.font.ascent + dc.font.descent; |
223 } | 234 } |