Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed reverse colour bug with XFT fonts in menu mode

git-svn-id: http://dzen.googlecode.com/svn/trunk@263 f2baff5b-bf2c-0410-a398-912abdc3d8b2
  • Loading branch information...
commit 6034c9d12b66f9d055cdd208ac8e8357eb63b9c5 1 parent 2df4dff
gotmor authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 draw.c
View
26 draw.c
@@ -392,6 +392,8 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
XftColor xftc;
char *xftcs;
int xftcs_f=0;
+ char *xftcs_bg;
+ int xftcs_bgf=0;
xftcs = (char *)dzen.fg;
#endif
@@ -436,6 +438,10 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
#ifdef DZEN_XPM
xpms.pixel = dzen.norm[ColBG];
#endif
+#ifdef DZEN_XFT
+ xftcs_bg = (char *)dzen.bg;
+ xftcs_bgf = 0;
+#endif
}
else {
XSetForeground(dzen.dpy, dzen.tgc, dzen.norm[ColFG]);
@@ -665,6 +671,17 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
case bg:
lastbg = tval[0] ? (unsigned)getcolor(tval) : dzen.norm[ColBG];
+#ifdef DZEN_XFT
+ if(xftcs_bgf) free(xftcs_bg);
+ if(tval[0]) {
+ xftcs_bg = estrdup(tval);
+ xftcs_bgf = 1;
+ } else {
+ xftcs_bg = (char *)dzen.bg;
+ xftcs_bgf = 0;
+ }
+#endif
+
break;
case fg:
@@ -771,8 +788,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
else
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);
+ } else {
XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
DefaultColormap(dzen.dpy, dzen.screen), xftcs, &xftc);
+ }
XftDrawStringUtf8(xftd, &xftc,
cur_fnt->xftfont, px, py + dzen.font.xftfont->ascent, lbuf, strlen(lbuf));
@@ -781,6 +803,10 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
free(xftcs);
xftcs_f = 0;
}
+ if(xftcs_bgf) {
+ free(xftcs_bg);
+ xftcs_bgf = 0;
+ }
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.