mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-15 09:44:04 +00:00
ncurses color fixes (#1482)
* specials: avoid duplicating color specials when both ncurses and a graphical output are enabled * ncurses: fix black we previously used the ncurses color as the id for its color pair, but this scheme needs to be shifted by one to avoid using the invalid 0 color-pair id for black (color id 0) --------- Co-authored-by: bi4k8 <bi4k8@github>
This commit is contained in:
parent
4a40eef51a
commit
3b1c9a7cc1
12
src/core.cc
12
src/core.cc
@ -748,20 +748,18 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
|
|||||||
obj->callbacks.graphval = &diskiographval_write;
|
obj->callbacks.graphval = &diskiographval_write;
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
END OBJ(color, nullptr)
|
END OBJ(color, nullptr)
|
||||||
|
if (false
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
if (out_to_gui(*state)) {
|
|| out_to_gui(*state)
|
||||||
Colour c = arg != nullptr ? parse_color(arg) : default_color.get(*state);
|
|
||||||
obj->data.l = c.to_argb32();
|
|
||||||
set_current_text_color(c);
|
|
||||||
}
|
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef BUILD_NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
if (out_to_ncurses.get(*state)) {
|
|| out_to_ncurses.get(*state)
|
||||||
|
#endif /* BUILD_NCURSES */
|
||||||
|
) {
|
||||||
Colour c = arg != nullptr ? parse_color(arg) : default_color.get(*state);
|
Colour c = arg != nullptr ? parse_color(arg) : default_color.get(*state);
|
||||||
obj->data.l = c.to_argb32();
|
obj->data.l = c.to_argb32();
|
||||||
set_current_text_color(c);
|
set_current_text_color(c);
|
||||||
}
|
}
|
||||||
#endif /* BUILD_NCURSES */
|
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
END OBJ(color0, nullptr) Colour c = color[0].get(*state);
|
END OBJ(color0, nullptr) Colour c = color[0].get(*state);
|
||||||
|
@ -128,8 +128,8 @@ bool display_output_ncurses::shutdown() { return false; }
|
|||||||
|
|
||||||
void display_output_ncurses::set_foreground_color(Colour c) {
|
void display_output_ncurses::set_foreground_color(Colour c) {
|
||||||
int nccolor = to_ncurses(c);
|
int nccolor = to_ncurses(c);
|
||||||
init_pair(nccolor, nccolor, COLOR_BLACK);
|
init_pair(nccolor+1, nccolor, COLOR_BLACK);
|
||||||
attron(COLOR_PAIR(nccolor));
|
attron(COLOR_PAIR(nccolor+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_output_ncurses::begin_draw_text() {
|
void display_output_ncurses::begin_draw_text() {
|
||||||
|
@ -666,14 +666,16 @@ void new_stippled_hr(struct text_object *obj, char *p,
|
|||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
|
|
||||||
void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||||
|
if (false
|
||||||
#ifdef BUILD_GUI
|
#ifdef BUILD_GUI
|
||||||
if (display_output() && display_output()->graphical()) {
|
|| (display_output() && display_output()->graphical())
|
||||||
new_special(p, FG)->arg = obj->data.l;
|
|
||||||
}
|
|
||||||
#endif /* BUILD_GUI */
|
#endif /* BUILD_GUI */
|
||||||
#ifdef BUILD_NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
if (out_to_ncurses.get(*state)) { new_special(p, FG)->arg = obj->data.l; }
|
|| out_to_ncurses.get(*state)
|
||||||
#endif /* BUILD_NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
|
) {
|
||||||
|
new_special(p, FG)->arg = obj->data.l;
|
||||||
|
}
|
||||||
UNUSED(obj);
|
UNUSED(obj);
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
UNUSED(p_max_size);
|
UNUSED(p_max_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user