aewl
changeset 350:b10852dbbffe
3->4 colors
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Thu, 24 Aug 2006 12:04:56 +0200 |
parents | 2bc2746a52c3 |
children | d822b5fbe11e |
files | config.arg.h config.default.h config.mk draw.c dwm.h main.c |
diffstat | 6 files changed, 22 insertions(+), 26 deletions(-) [+] |
line diff
1.1 --- a/config.arg.h Thu Aug 24 10:28:50 2006 +0200 1.2 +++ b/config.arg.h Thu Aug 24 12:04:56 2006 +0200 1.3 @@ -8,9 +8,10 @@ 1.4 1.5 #define DEFMODE dotile /* dofloat */ 1.6 #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" 1.7 -#define BGCOLOR "#666699" 1.8 -#define FGCOLOR "#eeeeee" 1.9 -#define BORDERCOLOR "#9999CC" 1.10 +#define NORMBGCOLOR "#666699" 1.11 +#define NORMFGCOLOR "#eeeeee" 1.12 +#define SELBGCOLOR "#eeeeee" 1.13 +#define SELFGCOLOR "#000088" 1.14 #define MODKEY Mod1Mask 1.15 #define MASTERW 60 /* percent */ 1.16
2.1 --- a/config.default.h Thu Aug 24 10:28:50 2006 +0200 2.2 +++ b/config.default.h Thu Aug 24 12:04:56 2006 +0200 2.3 @@ -8,9 +8,10 @@ 2.4 2.5 #define DEFMODE dotile /* dofloat */ 2.6 #define FONT "fixed" 2.7 -#define BGCOLOR "#666699" 2.8 -#define FGCOLOR "#eeeeee" 2.9 -#define BORDERCOLOR "#9999CC" 2.10 +#define NORMBGCOLOR "#666699" 2.11 +#define NORMFGCOLOR "#eeeeee" 2.12 +#define SELBGCOLOR "#eeeeee" 2.13 +#define SELFGCOLOR "#666699" 2.14 #define MODKEY Mod1Mask 2.15 #define MASTERW 60 /* percent */ 2.16
3.1 --- a/config.mk Thu Aug 24 10:28:50 2006 +0200 3.2 +++ b/config.mk Thu Aug 24 12:04:56 2006 +0200 3.3 @@ -1,5 +1,5 @@ 3.4 # dwm version 3.5 -VERSION = 1.0 3.6 +VERSION = 1.1 3.7 3.8 # Customize below to fit your system 3.9
4.1 --- a/draw.c Thu Aug 24 10:28:50 2006 +0200 4.2 +++ b/draw.c Thu Aug 24 12:04:56 2006 +0200 4.3 @@ -22,16 +22,15 @@ 4.4 } 4.5 4.6 static void 4.7 -drawtext(const char *text, Bool invert, Bool highlight) 4.8 +drawtext(const char *text, unsigned int colidx, Bool highlight) 4.9 { 4.10 int x, y, w, h; 4.11 static char buf[256]; 4.12 unsigned int len, olen; 4.13 - XGCValues gcv; 4.14 XPoint points[5]; 4.15 XRectangle r = { dc.x, dc.y, dc.w, dc.h }; 4.16 4.17 - XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg); 4.18 + XSetForeground(dpy, dc.gc, dc.bg[colidx]); 4.19 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); 4.20 points[0].x = dc.x; 4.21 points[0].y = dc.y; 4.22 @@ -43,7 +42,7 @@ 4.23 points[3].y = 0; 4.24 points[4].x = 0; 4.25 points[4].y = -(dc.h - 1); 4.26 - XSetForeground(dpy, dc.gc, dc.border); 4.27 + XSetForeground(dpy, dc.gc, dc.fg[colidx]); 4.28 XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); 4.29 4.30 if(!text) 4.31 @@ -74,15 +73,10 @@ 4.32 4.33 if(w > dc.w) 4.34 return; /* too long */ 4.35 - gcv.foreground = invert ? dc.bg : dc.fg; 4.36 - gcv.background = invert ? dc.fg : dc.bg; 4.37 - if(dc.font.set) { 4.38 - XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); 4.39 + if(dc.font.set) 4.40 XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len); 4.41 - } 4.42 else { 4.43 - gcv.font = dc.font.xfont->fid; 4.44 - XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); 4.45 + XSetFont(dpy, dc.gc, dc.font.xfont->fid); 4.46 XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); 4.47 } 4.48 if(highlight) { 4.49 @@ -157,11 +151,11 @@ 4.50 if(c == sel && issel) { 4.51 drawstatus(); 4.52 XUnmapWindow(dpy, c->twin); 4.53 - XSetWindowBorder(dpy, c->win, dc.fg); 4.54 + XSetWindowBorder(dpy, c->win, dc.fg[1]); 4.55 return; 4.56 } 4.57 4.58 - XSetWindowBorder(dpy, c->win, dc.bg); 4.59 + XSetWindowBorder(dpy, c->win, dc.bg[0]); 4.60 XMapWindow(dpy, c->twin); 4.61 dc.x = dc.y = 0; 4.62 dc.w = c->tw;
5.1 --- a/dwm.h Thu Aug 24 10:28:50 2006 +0200 5.2 +++ b/dwm.h Thu Aug 24 12:04:56 2006 +0200 5.3 @@ -36,9 +36,8 @@ 5.4 5.5 typedef struct { /* draw context */ 5.6 int x, y, w, h; 5.7 - unsigned long bg; 5.8 - unsigned long fg; 5.9 - unsigned long border; 5.10 + unsigned long bg[2]; 5.11 + unsigned long fg[2]; 5.12 Drawable drawable; 5.13 Fnt font; 5.14 GC gc;
6.1 --- a/main.c Thu Aug 24 10:28:50 2006 +0200 6.2 +++ b/main.c Thu Aug 24 12:04:56 2006 +0200 6.3 @@ -121,9 +121,10 @@ 6.4 seltag[0] = True; 6.5 6.6 /* style */ 6.7 - dc.bg = getcolor(BGCOLOR); 6.8 - dc.fg = getcolor(FGCOLOR); 6.9 - dc.border = getcolor(BORDERCOLOR); 6.10 + dc.bg[0] = getcolor(NORMBGCOLOR); 6.11 + dc.fg[0] = getcolor(NORMFGCOLOR); 6.12 + dc.bg[1] = getcolor(SELBGCOLOR); 6.13 + dc.fg[1] = getcolor(SELFGCOLOR); 6.14 setfont(FONT); 6.15 6.16 sx = sy = 0;