Mercurial > aewl
comparison draw.c @ 461:9d23330a5268
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Tue, 12 Sep 2006 10:57:28 +0200 |
parents | b1159a638d0a |
children | 8d564b9e3cd4 |
comparison
equal
deleted
inserted
replaced
460:ab4b08d49d24 | 461:9d23330a5268 |
---|---|
8 #include <X11/Xlocale.h> | 8 #include <X11/Xlocale.h> |
9 | 9 |
10 /* static */ | 10 /* static */ |
11 | 11 |
12 static unsigned int | 12 static unsigned int |
13 textnw(const char *text, unsigned int len) | 13 textnw(const char *text, unsigned int len) { |
14 { | |
15 XRectangle r; | 14 XRectangle r; |
16 | 15 |
17 if(dc.font.set) { | 16 if(dc.font.set) { |
18 XmbTextExtents(dc.font.set, text, len, NULL, &r); | 17 XmbTextExtents(dc.font.set, text, len, NULL, &r); |
19 return r.width; | 18 return r.width; |
20 } | 19 } |
21 return XTextWidth(dc.font.xfont, text, len); | 20 return XTextWidth(dc.font.xfont, text, len); |
22 } | 21 } |
23 | 22 |
24 static void | 23 static void |
25 drawtext(const char *text, unsigned long col[ColLast], Bool highlight) | 24 drawtext(const char *text, unsigned long col[ColLast], Bool highlight) { |
26 { | |
27 int x, y, w, h; | 25 int x, y, w, h; |
28 static char buf[256]; | 26 static char buf[256]; |
29 unsigned int len, olen; | 27 unsigned int len, olen; |
30 XGCValues gcv; | 28 XGCValues gcv; |
31 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 29 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
80 } | 78 } |
81 | 79 |
82 /* extern */ | 80 /* extern */ |
83 | 81 |
84 void | 82 void |
85 drawall() | 83 drawall() { |
86 { | |
87 Client *c; | 84 Client *c; |
88 | 85 |
89 for(c = clients; c; c = getnext(c->next)) | 86 for(c = clients; c; c = getnext(c->next)) |
90 drawtitle(c); | 87 drawtitle(c); |
91 drawstatus(); | 88 drawstatus(); |
92 } | 89 } |
93 | 90 |
94 void | 91 void |
95 drawstatus() | 92 drawstatus() { |
96 { | |
97 int i, x; | 93 int i, x; |
98 | 94 |
99 dc.x = dc.y = 0; | 95 dc.x = dc.y = 0; |
100 | 96 |
101 for(i = 0; i < ntags; i++) { | 97 for(i = 0; i < ntags; i++) { |
129 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); | 125 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); |
130 XSync(dpy, False); | 126 XSync(dpy, False); |
131 } | 127 } |
132 | 128 |
133 void | 129 void |
134 drawtitle(Client *c) | 130 drawtitle(Client *c) { |
135 { | |
136 if(c == sel && issel) { | 131 if(c == sel && issel) { |
137 drawstatus(); | 132 drawstatus(); |
138 XUnmapWindow(dpy, c->twin); | 133 XUnmapWindow(dpy, c->twin); |
139 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); | 134 XSetWindowBorder(dpy, c->win, dc.sel[ColBG]); |
140 return; | 135 return; |
148 XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); | 143 XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0); |
149 XSync(dpy, False); | 144 XSync(dpy, False); |
150 } | 145 } |
151 | 146 |
152 unsigned long | 147 unsigned long |
153 getcolor(const char *colstr) | 148 getcolor(const char *colstr) { |
154 { | |
155 Colormap cmap = DefaultColormap(dpy, screen); | 149 Colormap cmap = DefaultColormap(dpy, screen); |
156 XColor color; | 150 XColor color; |
157 | 151 |
158 XAllocNamedColor(dpy, cmap, colstr, &color, &color); | 152 XAllocNamedColor(dpy, cmap, colstr, &color, &color); |
159 return color.pixel; | 153 return color.pixel; |
160 } | 154 } |
161 | 155 |
162 void | 156 void |
163 setfont(const char *fontstr) | 157 setfont(const char *fontstr) { |
164 { | |
165 char **missing, *def; | 158 char **missing, *def; |
166 int i, n; | 159 int i, n; |
167 | 160 |
168 missing = NULL; | 161 missing = NULL; |
169 setlocale(LC_ALL, ""); | 162 setlocale(LC_ALL, ""); |
209 } | 202 } |
210 dc.font.height = dc.font.ascent + dc.font.descent; | 203 dc.font.height = dc.font.ascent + dc.font.descent; |
211 } | 204 } |
212 | 205 |
213 unsigned int | 206 unsigned int |
214 textw(const char *text) | 207 textw(const char *text) { |
215 { | |
216 return textnw(text, strlen(text)) + dc.font.height; | 208 return textnw(text, strlen(text)) + dc.font.height; |
217 } | 209 } |