Mercurial > aewl
comparison draw.c @ 728:295c8ca7a27a
applied apm's patch proposal, getting rid of XDrawLines
author | Anselm R. Garbe <arg@suckless.org> |
---|---|
date | Mon, 05 Feb 2007 11:05:16 +0100 |
parents | 4d12382fef8e |
children | 61821891835c |
comparison
equal
deleted
inserted
replaced
727:1a1f8a7e6729 | 728:295c8ca7a27a |
---|---|
33 int x, y, w, h; | 33 int x, y, w, h; |
34 static char buf[256]; | 34 static char buf[256]; |
35 unsigned int len, olen; | 35 unsigned int len, olen; |
36 XGCValues gcv; | 36 XGCValues gcv; |
37 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 37 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
38 XPoint pt[5]; | |
39 | 38 |
40 XSetForeground(dpy, dc.gc, col[ColBG]); | 39 XSetForeground(dpy, dc.gc, col[ColBG]); |
41 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); | 40 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
42 if(!text) | 41 if(!text) |
43 return; | 42 return; |
72 gcv.font = dc.font.xfont->fid; | 71 gcv.font = dc.font.xfont->fid; |
73 XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); | 72 XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); |
74 XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); | 73 XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
75 } | 74 } |
76 x = (h + 2) / 4; | 75 x = (h + 2) / 4; |
76 r.x = dc.x + 1; | |
77 r.y = dc.y + 1; | |
77 if(filledsquare) { | 78 if(filledsquare) { |
78 r.x = dc.x + 1; | |
79 r.y = dc.y + 1; | |
80 r.width = r.height = x + 1; | 79 r.width = r.height = x + 1; |
81 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); | 80 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
82 } | 81 } |
83 else if(emptysquare) { | 82 else if(emptysquare) { |
84 pt[0].x = dc.x + 1; | 83 r.width = r.height = x; |
85 pt[0].y = dc.y + 1; | 84 XDrawRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
86 pt[1].x = x; | |
87 pt[1].y = 0; | |
88 pt[2].x = 0; | |
89 pt[2].y = x; | |
90 pt[3].x = -x; | |
91 pt[3].y = 0; | |
92 pt[4].x = 0; | |
93 pt[4].y = -x; | |
94 XDrawLines(dpy, dc.drawable, dc.gc, pt, 5, CoordModePrevious); | |
95 } | 85 } |
96 } | 86 } |
97 | 87 |
98 /* extern */ | 88 /* extern */ |
99 | 89 |