From 1a6803454c90005d3ee3f2b3b0a4692a546468bc Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 8 Nov 2009 16:25:11 +0100 Subject: [PATCH] color: convert to callbacks.print --- src/conky.c | 35 ----------------------------------- src/core.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 35 deletions(-) diff --git a/src/conky.c b/src/conky.c index a4774d7d..ec7fefa8 100644 --- a/src/conky.c +++ b/src/conky.c @@ -898,41 +898,6 @@ void generate_text_internal(char *p, int p_max_size, OBJ(loadgraph) { print_loadgraph(obj, p, p_max_size); } -#endif /* X11 */ - OBJ(color) { - new_fg(obj, p, p_max_size); - } -#ifdef X11 - OBJ(color0) { - new_fg(obj, p, p_max_size); - } - OBJ(color1) { - new_fg(obj, p, p_max_size); - } - OBJ(color2) { - new_fg(obj, p, p_max_size); - } - OBJ(color3) { - new_fg(obj, p, p_max_size); - } - OBJ(color4) { - new_fg(obj, p, p_max_size); - } - OBJ(color5) { - new_fg(obj, p, p_max_size); - } - OBJ(color6) { - new_fg(obj, p, p_max_size); - } - OBJ(color7) { - new_fg(obj, p, p_max_size); - } - OBJ(color8) { - new_fg(obj, p, p_max_size); - } - OBJ(color9) { - new_fg(obj, p, p_max_size); - } #endif /* X11 */ #if defined(__linux__) OBJ(disk_protect) { diff --git a/src/core.c b/src/core.c index 5831db5b..f66a9308 100644 --- a/src/core.c +++ b/src/core.c @@ -151,6 +151,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long if (s[0] == '#') { obj->type = OBJ_color; obj->data.l = get_x11_color(s); + obj->callbacks.print = &new_fg; } else #endif /* X11 */ #ifdef __OpenBSD__ @@ -445,36 +446,47 @@ struct text_object *construct_text_object(const char *s, const char *arg, long init_pair(obj->data.l, obj->data.l, COLOR_BLACK); } #endif /* NCURSES */ + obj->callbacks.print = &new_fg; END OBJ(color0, 0) obj->data.l = color0; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color1, 0) obj->data.l = color1; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color2, 0) obj->data.l = color2; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color3, 0) obj->data.l = color3; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color4, 0) obj->data.l = color4; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color5, 0) obj->data.l = color5; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color6, 0) obj->data.l = color6; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color7, 0) obj->data.l = color7; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color8, 0) obj->data.l = color8; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; END OBJ(color9, 0) obj->data.l = color9; set_current_text_color(obj->data.l); + obj->callbacks.print = &new_fg; #ifdef X11 END OBJ(font, 0) obj->data.s = scan_font(arg);