dwm-noxz

[fork] suckless dwm - personal fork
git clone https://noxz.tech/git/dwm-noxz.git
dwm-noxz

commit: 376c65237b0e48aeacd21f21bd3d683a7bac1808
parent: d581a52b9de585cb9ad89b635c725de2807f6c7b
author: Chris Noxz <chris@noxz.tech>
date:   Sat, 18 Mar 2023 14:08:10 +0100
Give more color options to drw_rect
Mdrw.c4++--
Mdrw.h4++--
Mdwm.c10+++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drw.c b/drw.c
@@ -238,11 +238,11 @@ drw_setscheme(Drw *drw, Clr *scm)
 }
 
 void
-drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
+drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, enum color_mode mode)
 {
 	if (!drw || !drw->scheme)
 		return;
-	XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
+	XSetForeground(drw->dpy, drw->gc, drw->scheme[mode].pixel);
 	if (filled)
 		XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
 	else
diff --git a/drw.h b/drw.h
@@ -12,7 +12,7 @@ typedef struct Fnt {
 	struct Fnt *next;
 } Fnt;
 
-enum { ColFg, ColBg, ColBorder, ColFloat }; /* Clr scheme index */
+enum color_mode { ColFg, ColBg, ColBorder, ColFloat }; /* Clr scheme index */
 typedef XftColor Clr;
 
 typedef struct {
@@ -50,7 +50,7 @@ void drw_setfontset(Drw *drw, Fnt *set);
 void drw_setscheme(Drw *drw, Clr *scm);
 
 /* Drawing functions */
-void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
+void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, enum color_mode mode);
 int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
 
 /* Map functions */
diff --git a/dwm.c b/dwm.c
@@ -961,7 +961,7 @@ drawbar(Monitor *m)
 			: SchemeTagsNorm]);
 		drw_text(drw, x, 0, w, bh, lrpad / 2, masterclientontag[i], urg & 1 << i);
 		if (m->tagset[m->seltags] & 1 << i)
-			drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
+			drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, ColBorder);
 		x += w;
 	}
 
@@ -977,10 +977,10 @@ drawbar(Monitor *m)
 			else
 				drw_text(drw, x, 0, w, bh, (m->ww - TEXTW(m->sel->name)) / 2 - x, m->sel->name, 0);
 			if (m->sel->isfloating)
-				drw_rect(drw, x + boxs + 1, boxs + 1, boxw, boxw, m->sel->isfixed, 0);
+				drw_rect(drw, x + boxs + 1, boxs + 1, boxw, boxw, m->sel->isfixed, ColFg);
 		} else {
 			drw_setscheme(drw, scheme[SchemeTitleNorm]);
-			drw_rect(drw, x, 0, w, bh, 1, 1);
+			drw_rect(drw, x, 0, w, bh, 1, ColBg);
 		}
 	}
 	drw_map(drw, m->barwin, 0, 0, m->ww, bh);
@@ -1011,9 +1011,9 @@ drawicon(int scheme_type, int *icon, int size, int offset)
 	drw_setscheme(drw, scheme[scheme_type]);
 
 	/* draw icon */
-	drw_rect(drw, offset, 0, i_basewidth, bh, 1, 1);
+	drw_rect(drw, offset, 0, i_basewidth, bh, 1, ColBg);
 	for (i = 0; i < size; i+=4)
-		drw_rect(drw, x + icon[i], y + icon[i+1], icon[i+2], icon[i+3], 1, 0);
+		drw_rect(drw, x + icon[i], y + icon[i+1], icon[i+2], icon[i+3], 1, ColFg);
 }
 
 void