Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 1 changed file with 26 additions and 0 deletions. Show diff stats Hide diff stats

  1. +26 0 draw.c
26 draw.c
@@ -392,6 +392,8 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
392 392 XftColor xftc;
393 393 char *xftcs;
394 394 int xftcs_f=0;
  395 + char *xftcs_bg;
  396 + int xftcs_bgf=0;
395 397
396 398 xftcs = (char *)dzen.fg;
397 399 #endif
@@ -436,6 +438,10 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
436 438 #ifdef DZEN_XPM
437 439 xpms.pixel = dzen.norm[ColBG];
438 440 #endif
  441 +#ifdef DZEN_XFT
  442 + xftcs_bg = (char *)dzen.bg;
  443 + xftcs_bgf = 0;
  444 +#endif
439 445 }
440 446 else {
441 447 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) {
665 671
666 672 case bg:
667 673 lastbg = tval[0] ? (unsigned)getcolor(tval) : dzen.norm[ColBG];
  674 +#ifdef DZEN_XFT
  675 + if(xftcs_bgf) free(xftcs_bg);
  676 + if(tval[0]) {
  677 + xftcs_bg = estrdup(tval);
  678 + xftcs_bgf = 1;
  679 + } else {
  680 + xftcs_bg = (char *)dzen.bg;
  681 + xftcs_bgf = 0;
  682 + }
  683 +#endif
  684 +
668 685 break;
669 686
670 687 case fg:
@@ -771,8 +788,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
771 788 else
772 789 XDrawString(dzen.dpy, pm, dzen.tgc, px, py+dzen.font.ascent, lbuf, strlen(lbuf));
773 790 #else
  791 + if(reverse) {
  792 + XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
  793 + DefaultColormap(dzen.dpy, dzen.screen), xftcs_bg, &xftc);
  794 + } else {
774 795 XftColorAllocName(dzen.dpy, DefaultVisual(dzen.dpy, dzen.screen),
775 796 DefaultColormap(dzen.dpy, dzen.screen), xftcs, &xftc);
  797 + }
776 798
777 799 XftDrawStringUtf8(xftd, &xftc,
778 800 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) {
781 803 free(xftcs);
782 804 xftcs_f = 0;
783 805 }
  806 + if(xftcs_bgf) {
  807 + free(xftcs_bg);
  808 + xftcs_bgf = 0;
  809 + }
784 810
785 811 #endif
786 812

0 comments on commit 6034c9d

Please sign in to comment.
Something went wrong with that request. Please try again.