summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2011-06-04 10:17:25 +0100
committerConnor Lane Smith <cls@lubutu.com>2011-06-04 10:17:25 +0100
commit2255bf46a0af475e70fb4cc90d912b435f21eb5e (patch)
treee5feae644a4dccadb081efacc0080f5623cc65db
parent04797343db457578906355cf1118548be90a183e (diff)
cleaner drawing
-rw-r--r--dwm.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/dwm.c b/dwm.c
index 2feb22e..05ab119 100644
--- a/dwm.c
+++ b/dwm.c
@@ -780,32 +780,22 @@ drawbars(void) {
void
drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
int x;
- XGCValues gcv;
- XRectangle r = { dc.x, dc.y, dc.w, dc.h };
- gcv.foreground = col[invert ? ColBG : ColFG];
- XChangeGC(dpy, dc.gc, GCForeground, &gcv);
+ XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG]);
x = (dc.font.ascent + dc.font.descent + 2) / 4;
- r.x = dc.x + 1;
- r.y = dc.y + 1;
- if(filled) {
- r.width = r.height = x + 1;
- XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
- }
- else if(empty) {
- r.width = r.height = x;
- XDrawRectangles(dpy, dc.drawable, dc.gc, &r, 1);
- }
+ if(filled)
+ XFillRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x+1, x+1);
+ else if(empty)
+ XDrawRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x, x);
}
void
drawtext(const char *text, unsigned long col[ColLast], Bool invert) {
char buf[256];
int i, x, y, h, len, olen;
- XRectangle r = { dc.x, dc.y, dc.w, dc.h };
XSetForeground(dpy, dc.gc, col[invert ? ColFG : ColBG]);
- XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
+ XFillRectangle(dpy, dc.drawable, dc.gc, dc.x, dc.y, dc.w, dc.h);
if(!text)
return;
olen = strlen(text);