equal
deleted
inserted
replaced
12 |
12 |
13 static void |
13 static void |
14 drawborder(void) |
14 drawborder(void) |
15 { |
15 { |
16 XPoint points[5]; |
16 XPoint points[5]; |
|
17 |
17 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
18 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
18 XSetForeground(dpy, dc.gc, dc.border); |
19 XSetForeground(dpy, dc.gc, dc.border); |
19 points[0].x = dc.x; |
20 points[0].x = dc.x; |
20 points[0].y = dc.y; |
21 points[0].y = dc.y; |
21 points[1].x = dc.w - 1; |
22 points[1].x = dc.w - 1; |
31 |
32 |
32 static unsigned int |
33 static unsigned int |
33 textnw(char *text, unsigned int len) |
34 textnw(char *text, unsigned int len) |
34 { |
35 { |
35 XRectangle r; |
36 XRectangle r; |
|
37 |
36 if(dc.font.set) { |
38 if(dc.font.set) { |
37 XmbTextExtents(dc.font.set, text, len, NULL, &r); |
39 XmbTextExtents(dc.font.set, text, len, NULL, &r); |
38 return r.width; |
40 return r.width; |
39 } |
41 } |
40 return XTextWidth(dc.font.xfont, text, len); |
42 return XTextWidth(dc.font.xfont, text, len); |
42 |
44 |
43 static void |
45 static void |
44 drawtext(const char *text, Bool invert, Bool border) |
46 drawtext(const char *text, Bool invert, Bool border) |
45 { |
47 { |
46 int x, y, w, h; |
48 int x, y, w, h; |
|
49 static char buf[256]; |
47 unsigned int len; |
50 unsigned int len; |
48 static char buf[256]; |
|
49 XGCValues gcv; |
51 XGCValues gcv; |
50 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
52 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
51 |
53 |
52 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
54 XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); |
53 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
55 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
168 } |
170 } |
169 |
171 |
170 unsigned long |
172 unsigned long |
171 getcolor(const char *colstr) |
173 getcolor(const char *colstr) |
172 { |
174 { |
|
175 Colormap cmap = DefaultColormap(dpy, screen); |
173 XColor color; |
176 XColor color; |
174 Colormap cmap = DefaultColormap(dpy, screen); |
|
175 |
177 |
176 XAllocNamedColor(dpy, cmap, colstr, &color, &color); |
178 XAllocNamedColor(dpy, cmap, colstr, &color, &color); |
177 return color.pixel; |
179 return color.pixel; |
178 } |
180 } |
179 |
181 |