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.
This commit is contained in:
bakkeby
2020-08-20 17:42:30 +02:00
parent ef287c46cd
commit 6b9c484b78
4 changed files with 66 additions and 245 deletions

View File

@@ -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);