about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2016-12-05 10:01:33 +0100
committerAnselm R Garbe <garbeam@gmail.com>2016-12-05 10:01:33 +0100
commit975c8983762246b50026d43079c60a78b341f81c (patch)
treeba1d30bb037c3c3c2f7d6ac6a93dc64413b20d8a /dwm.c
parenta137a86a234476bc3c7128fecbf845e6fc1de995 (diff)
downloaddwm-975c8983762246b50026d43079c60a78b341f81c.tar.gz
applied Markus' decouple color-scheme patch
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/dwm.c b/dwm.c
index dbff59b..3d6cc28 100644
--- a/dwm.c
+++ b/dwm.c
@@ -60,7 +60,7 @@
 
 /* enums */
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */
+enum { SchemeNorm, SchemeSel }; /* color schemes */
 enum { NetSupported, NetWMName, NetWMState,
        NetWMFullscreen, NetActiveWindow, NetWMWindowType,
        NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@@ -263,7 +263,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
 static Atom wmatom[WMLast], netatom[NetLast];
 static int running = 1;
 static Cur *cursor[CurLast];
-static Scm scheme[SchemeLast];
+static Scm *scheme;
 static Display *dpy;
 static Drw *drw;
 static Monitor *mons, *selmon;
@@ -483,7 +483,7 @@ cleanup(void)
 		cleanupmon(mons);
 	for (i = 0; i < CurLast; i++)
 		drw_cur_free(drw, cursor[i]);
-	for (i = 0; i < SchemeLast; i++)
+	for (i = 0; i < LENGTH(colors); i++)
 		free(scheme[i]);
 	drw_free(drw);
 	XSync(dpy, False);
@@ -1549,6 +1549,7 @@ setmfact(const Arg *arg)
 void
 setup(void)
 {
+	int i;
 	XSetWindowAttributes wa;
 
 	/* clean up any zombies immediately */
@@ -1583,8 +1584,9 @@ setup(void)
 	cursor[CurResize] = drw_cur_create(drw, XC_sizing);
 	cursor[CurMove] = drw_cur_create(drw, XC_fleur);
 	/* init appearance */
-	scheme[SchemeNorm] = drw_scm_create(drw, colors[SchemeNorm], 3);
-	scheme[SchemeSel] = drw_scm_create(drw, colors[SchemeSel], 3);
+	scheme = ecalloc(LENGTH(colors), sizeof(Scm));
+	for (i = 0; i < LENGTH(colors); i++)
+		scheme[i] = drw_scm_create(drw, colors[i], 3);
 	/* init bars */
 	updatebars();
 	updatestatus();