Rename color_strings to colors
This is an antipattern and makes linelength increase for nothing
This commit is contained in:
parent
d190af6db1
commit
eae071f330
@ -284,10 +284,10 @@ static void on_notify(GDBusConnection *connection,
|
|||||||
n->actions = actions;
|
n->actions = actions;
|
||||||
|
|
||||||
for (int i = 0; i < ColLast; i++) {
|
for (int i = 0; i < ColLast; i++) {
|
||||||
n->color_strings[i] = NULL;
|
n->colors[i] = NULL;
|
||||||
}
|
}
|
||||||
n->color_strings[ColFG] = fgcolor;
|
n->colors[ColFG] = fgcolor;
|
||||||
n->color_strings[ColBG] = bgcolor;
|
n->colors[ColBG] = bgcolor;
|
||||||
|
|
||||||
notification_init(n);
|
notification_init(n);
|
||||||
int id = queues_notification_insert(n, replaces_id);
|
int id = queues_notification_insert(n, replaces_id);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#define ColBG 0
|
#define ColBG 0
|
||||||
|
|
||||||
extern GSList *rules;
|
extern GSList *rules;
|
||||||
extern const char *color_strings[3][3];
|
extern const char *colors[3][3];
|
||||||
|
|
||||||
/* return id of notification */
|
/* return id of notification */
|
||||||
gboolean run(void *data);
|
gboolean run(void *data);
|
||||||
|
@ -40,9 +40,9 @@ void notification_print(notification *n)
|
|||||||
printf("\turgency: %s\n", notification_urgency_to_string(n->urgency));
|
printf("\turgency: %s\n", notification_urgency_to_string(n->urgency));
|
||||||
printf("\ttransient: %d\n", n->transient);
|
printf("\ttransient: %d\n", n->transient);
|
||||||
printf("\tformatted: '%s'\n", n->msg);
|
printf("\tformatted: '%s'\n", n->msg);
|
||||||
printf("\tfg: %s\n", n->color_strings[ColFG]);
|
printf("\tfg: %s\n", n->colors[ColFG]);
|
||||||
printf("\tbg: %s\n", n->color_strings[ColBG]);
|
printf("\tbg: %s\n", n->colors[ColBG]);
|
||||||
printf("\tframe: %s\n", n->color_strings[ColFrame]);
|
printf("\tframe: %s\n", n->colors[ColFrame]);
|
||||||
printf("\tid: %d\n", n->id);
|
printf("\tid: %d\n", n->id);
|
||||||
if (n->urls) {
|
if (n->urls) {
|
||||||
printf("\turls:\n");
|
printf("\turls:\n");
|
||||||
@ -447,16 +447,16 @@ void notification_init(notification *n)
|
|||||||
if (n->urgency > URG_MAX)
|
if (n->urgency > URG_MAX)
|
||||||
n->urgency = URG_CRIT;
|
n->urgency = URG_CRIT;
|
||||||
|
|
||||||
if (!n->color_strings[ColFG]) {
|
if (!n->colors[ColFG]) {
|
||||||
n->color_strings[ColFG] = xctx.color_strings[ColFG][n->urgency];
|
n->colors[ColFG] = xctx.colors[ColFG][n->urgency];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!n->color_strings[ColBG]) {
|
if (!n->colors[ColBG]) {
|
||||||
n->color_strings[ColBG] = xctx.color_strings[ColBG][n->urgency];
|
n->colors[ColBG] = xctx.colors[ColBG][n->urgency];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!n->color_strings[ColFrame]) {
|
if (!n->colors[ColFrame]) {
|
||||||
n->color_strings[ColFrame] = xctx.color_strings[ColFrame][n->urgency];
|
n->colors[ColFrame] = xctx.colors[ColFrame][n->urgency];
|
||||||
}
|
}
|
||||||
|
|
||||||
n->timeout =
|
n->timeout =
|
||||||
|
@ -55,7 +55,7 @@ typedef struct _notification {
|
|||||||
|
|
||||||
enum markup_mode markup;
|
enum markup_mode markup;
|
||||||
const char *format;
|
const char *format;
|
||||||
const char *color_strings[3];
|
const char *colors[3];
|
||||||
const char *script;
|
const char *script;
|
||||||
|
|
||||||
/* Hints */
|
/* Hints */
|
||||||
|
@ -29,9 +29,9 @@ void rule_apply(rule_t *r, notification *n)
|
|||||||
n->raw_icon = NULL;
|
n->raw_icon = NULL;
|
||||||
}
|
}
|
||||||
if (r->fg)
|
if (r->fg)
|
||||||
n->color_strings[ColFG] = r->fg;
|
n->colors[ColFG] = r->fg;
|
||||||
if (r->bg)
|
if (r->bg)
|
||||||
n->color_strings[ColBG] = r->bg;
|
n->colors[ColBG] = r->bg;
|
||||||
if (r->format)
|
if (r->format)
|
||||||
n->format = r->format;
|
n->format = r->format;
|
||||||
if (r->script)
|
if (r->script)
|
||||||
|
30
src/x11/x.c
30
src/x11/x.c
@ -468,9 +468,9 @@ static colored_layout *r_init_shared(cairo_t *c, notification *n)
|
|||||||
cl->icon = NULL;
|
cl->icon = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cl->fg = x_string_to_color_t(n->color_strings[ColFG]);
|
cl->fg = x_string_to_color_t(n->colors[ColFG]);
|
||||||
cl->bg = x_string_to_color_t(n->color_strings[ColBG]);
|
cl->bg = x_string_to_color_t(n->colors[ColBG]);
|
||||||
cl->frame = x_string_to_color_t(n->color_strings[ColFrame]);
|
cl->frame = x_string_to_color_t(n->colors[ColFrame]);
|
||||||
|
|
||||||
cl->n = n;
|
cl->n = n;
|
||||||
|
|
||||||
@ -985,26 +985,26 @@ void x_setup(void)
|
|||||||
x_shortcut_grab(&settings.context_ks);
|
x_shortcut_grab(&settings.context_ks);
|
||||||
x_shortcut_ungrab(&settings.context_ks);
|
x_shortcut_ungrab(&settings.context_ks);
|
||||||
|
|
||||||
xctx.color_strings[ColFG][URG_LOW] = settings.lowfgcolor;
|
xctx.colors[ColFG][URG_LOW] = settings.lowfgcolor;
|
||||||
xctx.color_strings[ColFG][URG_NORM] = settings.normfgcolor;
|
xctx.colors[ColFG][URG_NORM] = settings.normfgcolor;
|
||||||
xctx.color_strings[ColFG][URG_CRIT] = settings.critfgcolor;
|
xctx.colors[ColFG][URG_CRIT] = settings.critfgcolor;
|
||||||
|
|
||||||
xctx.color_strings[ColBG][URG_LOW] = settings.lowbgcolor;
|
xctx.colors[ColBG][URG_LOW] = settings.lowbgcolor;
|
||||||
xctx.color_strings[ColBG][URG_NORM] = settings.normbgcolor;
|
xctx.colors[ColBG][URG_NORM] = settings.normbgcolor;
|
||||||
xctx.color_strings[ColBG][URG_CRIT] = settings.critbgcolor;
|
xctx.colors[ColBG][URG_CRIT] = settings.critbgcolor;
|
||||||
|
|
||||||
if (settings.lowframecolor)
|
if (settings.lowframecolor)
|
||||||
xctx.color_strings[ColFrame][URG_LOW] = settings.lowframecolor;
|
xctx.colors[ColFrame][URG_LOW] = settings.lowframecolor;
|
||||||
else
|
else
|
||||||
xctx.color_strings[ColFrame][URG_LOW] = settings.frame_color;
|
xctx.colors[ColFrame][URG_LOW] = settings.frame_color;
|
||||||
if (settings.normframecolor)
|
if (settings.normframecolor)
|
||||||
xctx.color_strings[ColFrame][URG_NORM] = settings.normframecolor;
|
xctx.colors[ColFrame][URG_NORM] = settings.normframecolor;
|
||||||
else
|
else
|
||||||
xctx.color_strings[ColFrame][URG_NORM] = settings.frame_color;
|
xctx.colors[ColFrame][URG_NORM] = settings.frame_color;
|
||||||
if (settings.critframecolor)
|
if (settings.critframecolor)
|
||||||
xctx.color_strings[ColFrame][URG_CRIT] = settings.critframecolor;
|
xctx.colors[ColFrame][URG_CRIT] = settings.critframecolor;
|
||||||
else
|
else
|
||||||
xctx.color_strings[ColFrame][URG_CRIT] = settings.frame_color;
|
xctx.colors[ColFrame][URG_CRIT] = settings.frame_color;
|
||||||
|
|
||||||
/* parse and set xctx.geometry and monitor position */
|
/* parse and set xctx.geometry and monitor position */
|
||||||
if (settings.geom[0] == '-') {
|
if (settings.geom[0] == '-') {
|
||||||
|
@ -28,7 +28,7 @@ typedef struct _xctx {
|
|||||||
Window win;
|
Window win;
|
||||||
bool visible;
|
bool visible;
|
||||||
dimension_t geometry;
|
dimension_t geometry;
|
||||||
const char *color_strings[3][3];
|
const char *colors[3][3];
|
||||||
XScreenSaverInfo *screensaver_info;
|
XScreenSaverInfo *screensaver_info;
|
||||||
dimension_t window_dim;
|
dimension_t window_dim;
|
||||||
unsigned long sep_custom_col;
|
unsigned long sep_custom_col;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user