summaryrefslogtreecommitdiffhomepage
path: root/patch/bar_vtcolors.c
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2020-08-20 17:42:30 +0200
committerbakkeby <[email protected]>2020-08-20 17:42:30 +0200
commit6b9c484b787efaabf574a3f4217023aa87b5b5c4 (patch)
tree53663cb145f6fbeff683ae6cf058eecba4e8052e /patch/bar_vtcolors.c
parentef287c46cdceac27614a1b117f80a140ecafc40d (diff)
downloaddwm-flexipatch-6b9c484b787efaabf574a3f4217023aa87b5b5c4.tar.gz
dwm-flexipatch-6b9c484b787efaabf574a3f4217023aa87b5b5c4.zip
Refactoring and simplifying color configuration in config.h
This involves always having configuration for floating border, regardless of whether it is used or not. Also permanently dropping the const expectation for color configuration in dwm, so that vtcolors and xrdb patches can change color configuration.
Diffstat (limited to 'patch/bar_vtcolors.c')
-rw-r--r--patch/bar_vtcolors.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/patch/bar_vtcolors.c b/patch/bar_vtcolors.c
index 349970f..2002985 100644
--- a/patch/bar_vtcolors.c
+++ b/patch/bar_vtcolors.c
@@ -12,8 +12,7 @@ get_vt_colors(void)
char *tp = NULL;
FILE *fp;
size_t r;
- int i, c, n;
-
+ int i, c, n, len;
for (i = 0; i < 16; i++)
strcpy(vtcs[i], "#000000");
@@ -33,13 +32,12 @@ get_vt_colors(void)
}
fclose(fp);
}
- for (i = 0; i < LENGTH(colors); i++) {
- #if FLOAT_BORDER_COLOR_PATCH
- for (c = 0; c < 4; c++)
- #else
- for (c = 0; c < 3; c++)
- #endif // FLOAT_BORDER_COLOR_PATCH
- {
+
+ len = LENGTH(colors);
+ if (len > LENGTH(color_ptrs))
+ len = LENGTH(color_ptrs);
+ for (i = 0; i < len; i++) {
+ for (c = 0; c < ColCount; c++) {
n = color_ptrs[i][c];
if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
memcpy(colors[i][c], vtcs[n], 7);