remove TERM_TRUECOLOR define

This commit is contained in:
Ailin Nemui 2022-02-19 21:53:51 +01:00
commit 0682cbed3c
9 changed files with 2 additions and 82 deletions

View file

@ -300,7 +300,6 @@ static char *text_effects_only(const char *p)
/* irssi color */
if (p[2] != '\0') {
#ifdef TERM_TRUECOLOR
if (p[1] == FORMAT_COLOR_24) {
if (p[3] == '\0') p += 2;
else if (p[4] == '\0') p += 3;
@ -310,12 +309,9 @@ static char *text_effects_only(const char *p)
p += 5;
}
} else {
#endif /* TERM_TRUECOLOR */
g_string_append_len(str, p, 3);
p += 2;
#ifdef TERM_TRUECOLOR
}
#endif /* TERM_TRUECOLOR */
continue;
}
}

View file

@ -245,9 +245,7 @@ void gui_printtext_get_colors(int *flags, int *fg, int *bg, int *attr)
if (*flags & GUI_PRINT_FLAG_MIRC_COLOR) {
/* mirc colors - extended colours proposal */
gboolean use_24_map = FALSE;
#ifdef TERM_TRUECOLOR
use_24_map = settings_get_bool("colors_ansi_24bit");
#endif
if (*bg >= 0) {
if (use_24_map && mirc_colors24[*bg % 100] != -1) {
*bg = mirc_colors24[*bg % 100];

View file

@ -339,33 +339,25 @@ static int termctl_set_color_24bit(int bg, unsigned int lc)
#define COLOR_BLACK24 COLOR_RESET - 1
/* Change active color */
#ifdef TERM_TRUECOLOR
void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigned int bgcol24)
#else
void term_set_color(TERM_WINDOW *window, int col)
#endif
{
int set_normal;
unsigned int fg, bg;
#ifdef TERM_TRUECOLOR
if (col & ATTR_FGCOLOR24) {
if (fgcol24)
fg = fgcol24 << 8;
else
fg = COLOR_BLACK24;
} else
#endif
fg = (col & FG_MASK);
#ifdef TERM_TRUECOLOR
if (col & ATTR_BGCOLOR24) {
if (bgcol24)
bg = bgcol24 << 8;
else
bg = COLOR_BLACK24;
} else
#endif
bg = ((col & BG_MASK) >> BG_SHIFT);
if (!term_use_colors && bg > 0)

View file

@ -150,12 +150,8 @@ static void read_settings(void)
term_use_colors = settings_get_bool("colors") &&
(force_colors || term_has_colors());
#ifdef TERM_TRUECOLOR
term_use_colors24 = settings_get_bool("colors_ansi_24bit") &&
(force_colors || term_has_colors());
#else
term_use_colors24 = FALSE;
#endif
if (term_use_colors != old_colors || term_use_colors24 != old_colors24)
irssi_redraw();
@ -173,12 +169,8 @@ void term_common_init(void)
force_colors = FALSE;
term_use_colors = term_has_colors() && settings_get_bool("colors");
#ifdef TERM_TRUECOLOR
settings_add_bool("lookandfeel", "colors_ansi_24bit", FALSE);
term_use_colors24 = term_has_colors() && settings_get_bool("colors_ansi_24bit");
#else
term_use_colors24 = FALSE;
#endif
read_settings();
if (g_get_charset(&dummy)) {

View file

@ -72,13 +72,8 @@ void term_window_clear(TERM_WINDOW *window);
/* Scroll window up/down */
void term_window_scroll(TERM_WINDOW *window, int count);
#ifdef TERM_TRUECOLOR
#define term_set_color(window, col) term_set_color2(window, (col) &~(ATTR_FGCOLOR24|ATTR_BGCOLOR24), UINT_MAX, UINT_MAX)
void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigned int bgcol24);
#else
#define term_set_color2(window, col, unused1, unused2) term_set_color(window, col)
void term_set_color(TERM_WINDOW *window, int col);
#endif
void term_move(TERM_WINDOW *window, int x, int y);
void term_addch(TERM_WINDOW *window, char chr);

View file

@ -118,7 +118,6 @@ static void textbuffer_cache_unref(TEXT_BUFFER_CACHE_REC *cache)
#define FGATTR (ATTR_NOCOLORS | ATTR_RESETFG | FG_MASK | ATTR_FGCOLOR24)
#define BGATTR (ATTR_NOCOLORS | ATTR_RESETBG | BG_MASK | ATTR_BGCOLOR24)
#ifdef TERM_TRUECOLOR
static void unformat_24bit_line_color(const unsigned char **ptr, int off, int *flags, unsigned int *fg, unsigned int *bg)
{
unsigned int color;
@ -145,7 +144,6 @@ static void unformat_24bit_line_color(const unsigned char **ptr, int off, int *f
*fg = color;
}
}
#endif
static inline unichar read_unichar(const unsigned char *data, const unsigned char **next, int *width)
{
@ -215,11 +213,9 @@ static inline void unformat(const unsigned char **ptr, int *color, unsigned int
break;
#undef SET_COLOR_EXT_BG_BITS
#undef SET_COLOR_EXT_FG_BITS
#ifdef TERM_TRUECOLOR
case FORMAT_COLOR_24:
unformat_24bit_line_color(ptr, 1, color, fg24, bg24);
break;
#endif
default:
if (**ptr != FORMAT_COLOR_NOCHANGE) {
if (**ptr == (unsigned char) 0xff) {
@ -289,10 +285,8 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
sub->start = ++ptr;
sub->color = color;
#ifdef TERM_TRUECOLOR
sub->fg24 = fg24;
sub->bg24 = bg24;
#endif
lines = g_slist_append(lines, sub);
linecount++;
@ -360,10 +354,8 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
sub->indent = xpos;
sub->indent_func = indent_func;
sub->color = color;
#ifdef TERM_TRUECOLOR
sub->fg24 = fg24;
sub->bg24 = bg24;
#endif
lines = g_slist_append(lines, sub);
linecount++;
@ -502,10 +494,8 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
if (indent_func == NULL || cache->lines[subline-1].continues)
xpos = cache->lines[subline-1].indent;
color = cache->lines[subline-1].color;
#ifdef TERM_TRUECOLOR
fg24 = cache->lines[subline-1].fg24;
bg24 = cache->lines[subline-1].bg24;
#endif
} else {
indent_func = NULL;
}

View file

@ -15,9 +15,7 @@ typedef struct {
int indent;
INDENT_FUNC indent_func;
int color;
#ifdef TERM_TRUECOLOR
unsigned int fg24, bg24;
#endif
/* first word in line belong to the end of the last word in
previous line */