applied Markus' decouple color-scheme patch

This commit is contained in:
Anselm R Garbe 2016-12-05 10:01:33 +01:00
parent a137a86a23
commit 975c898376
2 changed files with 8 additions and 6 deletions

View File

@ -12,7 +12,7 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb"; static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee"; static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577"; static const char col_cyan[] = "#005577";
static const char *colors[SchemeLast][3] = { static const char *colors[][3] = {
/* fg bg border */ /* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan }, [SchemeSel] = { col_gray4, col_cyan, col_cyan },

12
dwm.c
View File

@ -60,7 +60,7 @@
/* enums */ /* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */ enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, enum { NetSupported, NetWMName, NetWMState,
NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@ -263,7 +263,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
static Atom wmatom[WMLast], netatom[NetLast]; static Atom wmatom[WMLast], netatom[NetLast];
static int running = 1; static int running = 1;
static Cur *cursor[CurLast]; static Cur *cursor[CurLast];
static Scm scheme[SchemeLast]; static Scm *scheme;
static Display *dpy; static Display *dpy;
static Drw *drw; static Drw *drw;
static Monitor *mons, *selmon; static Monitor *mons, *selmon;
@ -483,7 +483,7 @@ cleanup(void)
cleanupmon(mons); cleanupmon(mons);
for (i = 0; i < CurLast; i++) for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]); drw_cur_free(drw, cursor[i]);
for (i = 0; i < SchemeLast; i++) for (i = 0; i < LENGTH(colors); i++)
free(scheme[i]); free(scheme[i]);
drw_free(drw); drw_free(drw);
XSync(dpy, False); XSync(dpy, False);
@ -1549,6 +1549,7 @@ setmfact(const Arg *arg)
void void
setup(void) setup(void)
{ {
int i;
XSetWindowAttributes wa; XSetWindowAttributes wa;
/* clean up any zombies immediately */ /* clean up any zombies immediately */
@ -1583,8 +1584,9 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur); cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */ /* init appearance */
scheme[SchemeNorm] = drw_scm_create(drw, colors[SchemeNorm], 3); scheme = ecalloc(LENGTH(colors), sizeof(Scm));
scheme[SchemeSel] = drw_scm_create(drw, colors[SchemeSel], 3); for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init bars */ /* init bars */
updatebars(); updatebars();
updatestatus(); updatestatus();