diff options
author | Anselm R. Garbe <arg@suckless.org> | 2007-03-02 15:16:36 +0100 |
---|---|---|
committer | Anselm R. Garbe <arg@suckless.org> | 2007-03-02 15:16:36 +0100 |
commit | 724f72142f6dc880068a92e412f3f3366e643569 (patch) | |
tree | d3ac4dc66f18021f9d9911d74c20bc8ca98dff9b | |
parent | 5b8dce15d3e4d1e50fc4f1df10665260f74a0a02 (diff) |
also, don't set the font all the time
-rw-r--r-- | config.mk | 2 | ||||
-rw-r--r-- | draw.c | 15 | ||||
-rw-r--r-- | main.c | 2 |
3 files changed, 7 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | # dmenu version | 1 | # dmenu version |
2 | VERSION = 2.6 | 2 | VERSION = 2.7 |
3 | 3 | ||
4 | # Customize below to fit your system | 4 | # Customize below to fit your system |
5 | 5 | ||
@@ -12,7 +12,6 @@ drawtext(const char *text, unsigned long col[ColLast]) { | |||
12 | int x, y, w, h; | 12 | int x, y, w, h; |
13 | static char buf[256]; | 13 | static char buf[256]; |
14 | unsigned int len, olen; | 14 | unsigned int len, olen; |
15 | XGCValues gcv; | ||
16 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 15 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
17 | 16 | ||
18 | XSetForeground(dpy, dc.gc, col[ColBG]); | 17 | XSetForeground(dpy, dc.gc, col[ColBG]); |
@@ -41,17 +40,11 @@ drawtext(const char *text, unsigned long col[ColLast]) { | |||
41 | } | 40 | } |
42 | if(w > dc.w) | 41 | if(w > dc.w) |
43 | return; /* too long */ | 42 | return; /* too long */ |
44 | gcv.foreground = col[ColFG]; | 43 | XSetForeground(dpy, dc.gc, col[ColFG]); |
45 | if(dc.font.set) { | 44 | if(dc.font.set) |
46 | XChangeGC(dpy, dc.gc, GCForeground, &gcv); | 45 | XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); |
47 | XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, | 46 | else |
48 | x, y, buf, len); | ||
49 | } | ||
50 | else { | ||
51 | gcv.font = dc.font.xfont->fid; | ||
52 | XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); | ||
53 | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); | 47 | XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
54 | } | ||
55 | } | 48 | } |
56 | 49 | ||
57 | unsigned int | 50 | unsigned int |
@@ -493,6 +493,8 @@ main(int argc, char *argv[]) { | |||
493 | dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen)); | 493 | dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen)); |
494 | dc.gc = XCreateGC(dpy, root, 0, 0); | 494 | dc.gc = XCreateGC(dpy, root, 0, 0); |
495 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); | 495 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
496 | if(!dc.font.set) | ||
497 | XSetFont(dpy, dc.gc, dc.font.xfont->fid); | ||
496 | if(maxname) | 498 | if(maxname) |
497 | cmdw = textw(maxname); | 499 | cmdw = textw(maxname); |
498 | if(cmdw > mw / 3) | 500 | if(cmdw > mw / 3) |