aboutsummaryrefslogtreecommitdiffstats
path: root/draw.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-02-21 01:19:29 -0600
committerJesse Luehrs <doy@tozt.net>2012-02-21 01:32:59 -0600
commit9bb42914a45161f9338ce05b4af0ad91c994c4ed (patch)
treec4b93047b97b20ce32cd83fe32f93ae48a6e02da /draw.c
parent8e7f8c02a1c6f1a916376f43cbce1271225c2ec7 (diff)
downloaddzen-9bb42914a45161f9338ce05b4af0ad91c994c4ed.tar.gz
dzen-9bb42914a45161f9338ce05b4af0ad91c994c4ed.zip
also cache XftColorAllocName, for the same reasonHEADmaster
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/draw.c b/draw.c
index f20ff45..7af1eb6 100644
--- a/draw.c
+++ b/draw.c
@@ -806,11 +806,17 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
XDrawString(dzen.dpy, pm, dzen.tgc, px, py+dzen.font.ascent, lbuf, strlen(lbuf));
#else
if(reverse) {
- XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
- DefaultColormap(dzen.dpy, dzen.screen), xftcs_bg, &xftc);
+ if (!xftcolorcache_get(xftcs_bg, &xftc)) {
+ XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
+ DefaultColormap(dzen.dpy, dzen.screen), xftcs_bg, &xftc);
+ xftcolorcache_set(xftcs_bg, &xftc);
+ }
} else {
- XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
- DefaultColormap(dzen.dpy, dzen.screen), xftcs, &xftc);
+ if (!xftcolorcache_get(xftcs, &xftc)) {
+ XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
+ DefaultColormap(dzen.dpy, dzen.screen), xftcs, &xftc);
+ xftcolorcache_set(xftcs, &xftc);
+ }
}
XftDrawStringUtf8(xftd, &xftc,