From b34f16e9df5cbcdd488175a7e4a1ab8e605d3a53 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 19 Feb 2022 21:51:12 +0100 Subject: [PATCH 1/2] remove enable-true-color compile time switch --- .github/workflows/termuxpkg.yml | 1 - meson.build | 4 +--- meson_options.txt | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/termuxpkg.yml b/.github/workflows/termuxpkg.yml index f46915e8..cbf7d3b2 100644 --- a/.github/workflows/termuxpkg.yml +++ b/.github/workflows/termuxpkg.yml @@ -37,7 +37,6 @@ jobs: TERMUX_PKG_BREAKS="irssi" TERMUX_PKG_REPLACES="irssi" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" - -Denable-true-color=yes -Dfhs-prefix=$TERMUX_PREFIX " diff --git a/meson.build b/meson.build index 31bdfa9f..f2a15ee1 100644 --- a/meson.build +++ b/meson.build @@ -32,7 +32,6 @@ want_fuzzer = get_option('with-fuzzer') == 'yes' fuzzer_lib = get_option('with-fuzzer-lib') fuzzer_link_language = get_option('fuzzer-link-language') want_proxy = get_option('with-proxy') == 'yes' -want_truecolor = get_option('enable-true-color') == 'yes' want_gregex = get_option('disable-gregex') != 'yes' require_capsicum = get_option('with-capsicum') == 'yes' @@ -521,7 +520,7 @@ conf = configuration_data() conf.set('HAVE_CAPSICUM', have_capsicum, description : 'Build with Capsicum support') conf.set('HAVE_GMODULE', true) conf.set('HAVE_SOCKS', false, description : 'Build with socks support') -conf.set('TERM_TRUECOLOR', want_truecolor, description : 'true color support in terminal') +conf.set('TERM_TRUECOLOR', true) conf.set('USE_GREGEX', want_gregex, description : 'use GRegex for regular expressions') conf.set10('_DARWIN_USE_64_BIT_INODE', true, description : 'Enable large inode numbers on Mac OS X 10.5.') conf.set_quoted('FHS_PREFIX', get_option('fhs-prefix')) @@ -627,7 +626,6 @@ if have_perl endif message('Install prefix ................... : ' + get_option('prefix')) message('') -message('Building with true color support.. : ' + want_truecolor.to_string('yes', 'no')) message('Building with GRegex ............. : ' + want_gregex.to_string('yes', 'no')) message('Building with Capsicum ........... : ' + have_capsicum.to_string('yes', 'no')) message('Building with utf8proc ........... : ' + have_libutf8proc.to_string('yes', 'no')) diff --git a/meson_options.txt b/meson_options.txt index 1013166d..617de554 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,7 +7,6 @@ option('with-proxy', type : 'combo', description : 'Build irssi-proxy', option('with-perl-lib', type : 'string', description : 'Specify where to install the Perl libraries for Irssi') option('with-perl', type : 'combo', description : 'Build with Perl support', choices : ['auto', 'yes', 'no']) option('with-otr', type : 'combo', description : 'Build with OTR support', choices : ['auto', 'yes', 'no']) -option('enable-true-color', type : 'combo', description : 'Build with true color support in terminal', choices : ['no', 'yes']) option('disable-gregex', type : 'combo', description : 'Build without GRegex (fall back to regex.h)', choices : ['no', 'yes']) option('disable-utf8proc', type : 'combo', description : 'Build without Julia\'s utf8proc', choices : ['auto', 'yes', 'no']) option('with-capsicum', type : 'combo', description : 'Build with Capsicum support', choices : ['auto', 'yes', 'no']) From 0682cbed3cb5dd0412209e6ed142112044ebc429 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 19 Feb 2022 21:53:51 +0100 Subject: [PATCH 2/2] remove TERM_TRUECOLOR define --- src/fe-common/core/formats.c | 43 ++--------------------------------- src/fe-common/core/formats.h | 2 -- src/fe-text/gui-entry.c | 4 ---- src/fe-text/gui-printtext.c | 2 -- src/fe-text/term-terminfo.c | 8 ------- src/fe-text/term.c | 8 ------- src/fe-text/term.h | 5 ---- src/fe-text/textbuffer-view.c | 10 -------- src/fe-text/textbuffer-view.h | 2 -- 9 files changed, 2 insertions(+), 82 deletions(-) diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index b660b616..cc8455eb 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -142,7 +142,6 @@ static void format_ext_color_unexpand(GString *out, gboolean bg, int base, char g_string_append_c(out, ext_color_al[value % 36]); } -#ifdef TERM_TRUECOLOR void unformat_24bit_color(char **ptr, int off, int *fgcolor, int *bgcolor, int *flags) { unsigned int color; @@ -191,12 +190,10 @@ static void format_24bit_color_unexpand(GString *out, int off, const char **ptr) g_string_append_c(out, rgbx[3] & 0x1 ? 'z' : 'Z'); g_string_append_printf(out, "%06X", color); } -#endif void format_24bit_color(GString *out, int bg, unsigned int color) { unsigned char rgb[] = { color >> 16, color >> 8, color }; -#ifdef TERM_TRUECOLOR unsigned char x = bg ? 0x1 : 0; unsigned int i; g_string_append_c(out, 4); @@ -210,9 +207,6 @@ void format_24bit_color(GString *out, int bg, unsigned int color) } } g_string_append_c(out, 0x20 + x); -#else /* !TERM_TRUECOLOR */ - format_ext_color(out, bg, color_24bit_256(rgb)); -#endif /* TERM_TRUECOLOR */ } int format_expand_styles(GString *out, const char **format, int *flags) @@ -668,11 +662,9 @@ char *format_string_unexpand(const char *text, int flags) case FORMAT_COLOR_EXT3_BG: format_ext_color_unexpand(out, TRUE, 0xb0, *++text); break; -#ifdef TERM_TRUECOLOR case FORMAT_COLOR_24: format_24bit_color_unexpand(out, 1, &text); break; -#endif case FORMAT_STYLE_BLINK: format_flag_unexpand(out, 'F'); break; @@ -1057,13 +1049,6 @@ void format_newline(TEXT_DEST_REC *dest) GINT_TO_POINTER(-1), GINT_TO_POINTER(GUI_PRINT_FLAG_NEWLINE), "", dest); } -#ifndef TERM_TRUECOLOR -inline static int color_24bit_256_int(unsigned int color) -{ - unsigned char rgb[] = { color >> 16, color >> 8, color }; - return color_24bit_256(rgb); -} -#endif /* !TERM_TRUECOLOR */ /* parse ANSI color string */ static const char *get_ansi_color(THEME_REC *theme, const char *str, @@ -1191,7 +1176,7 @@ static const char *get_ansi_color(THEME_REC *theme, const char *str, } if (i == -1) break; -#ifdef TERM_TRUECOLOR + if (num == 38) { flags |= GUI_PRINT_FLAG_COLOR_24_FG; fg = num2; @@ -1199,15 +1184,6 @@ static const char *get_ansi_color(THEME_REC *theme, const char *str, flags |= GUI_PRINT_FLAG_COLOR_24_BG; bg = num2; } -#else /* !TERM_TRUECOLOR */ - if (num == 38) { - flags &= ~GUI_PRINT_FLAG_COLOR_24_FG; - fg = color_24bit_256_int(num2); - } else if (num == 48) { - flags &= ~GUI_PRINT_FLAG_COLOR_24_BG; - bg = color_24bit_256_int(num2); - } -#endif break; case 5: @@ -1332,7 +1308,6 @@ int strip_real_length(const char *str, int len, /* We expect 4 to indicate an internal Irssi color code. However 4 * also means hex color, an alternative to mIRC color codes. We * don't support those. */ -#ifdef TERM_TRUECOLOR if (str[1] == FORMAT_COLOR_24 && str[2] != '\0') { if (str[3] == '\0') str++; else if (str[4] == '\0') str += 2; @@ -1344,9 +1319,7 @@ int strip_real_length(const char *str, int len, *last_color_len = 6; str+=4; } - } else -#endif - if (str[1] < FORMAT_STYLE_SPECIAL && str[2] != '\0') { + } else if (str[1] < FORMAT_STYLE_SPECIAL && str[2] != '\0') { if (last_color_pos != NULL) *last_color_pos = (int) (str-start); if (last_color_len != NULL) @@ -1395,14 +1368,12 @@ char *strip_codes(const char *input) /* 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; else if (p[5] == '\0') p += 4; else p += 5; } else -#endif /* TERM_TRUECOLOR */ p += 2; continue; } @@ -1550,11 +1521,9 @@ void format_send_as_gui_flags(TEXT_DEST_REC *dest, const char *text, SIGNAL_FUNC bgcolor = 0xb0 + *++ptr - FORMAT_COLOR_NOCHANGE; flags &= ~GUI_PRINT_FLAG_COLOR_24_BG; break; -#ifdef TERM_TRUECOLOR case FORMAT_COLOR_24: unformat_24bit_color(&ptr, 1, &fgcolor, &bgcolor, &flags); break; -#endif default: if (*ptr != FORMAT_COLOR_NOCHANGE) { flags &= ~GUI_PRINT_FLAG_COLOR_24_FG; @@ -1637,13 +1606,11 @@ void format_gui_flags(GString *out, int *last_fg, int *last_bg, int *last_flags, (flags & GUI_PRINT_FLAG_COLOR_24_FG) != (*last_flags & GUI_PRINT_FLAG_COLOR_24_FG)) { *last_fg = fg; -#ifdef TERM_TRUECOLOR if (flags & GUI_PRINT_FLAG_COLOR_24_FG) { *last_flags |= GUI_PRINT_FLAG_COLOR_24_FG; format_24bit_color(out, 0, fg); } else { *last_flags &= ~GUI_PRINT_FLAG_COLOR_24_FG; -#endif if (fg < 0) { g_string_append_c(out, 4); g_string_append_c(out, (char) -1); @@ -1651,20 +1618,16 @@ void format_gui_flags(GString *out, int *last_fg, int *last_bg, int *last_flags, } else { format_ext_color(out, 0, fg); } -#ifdef TERM_TRUECOLOR } -#endif } if (bg != *last_bg || (flags & GUI_PRINT_FLAG_COLOR_24_BG) != (*last_flags & GUI_PRINT_FLAG_COLOR_24_BG)) { *last_bg = bg; -#ifdef TERM_TRUECOLOR if (flags & GUI_PRINT_FLAG_COLOR_24_BG) { *last_flags |= GUI_PRINT_FLAG_COLOR_24_BG; format_24bit_color(out, 1, bg); } else { *last_flags &= ~GUI_PRINT_FLAG_COLOR_24_BG; -#endif if (bg < 0) { g_string_append_c(out, 4); g_string_append_c(out, FORMAT_COLOR_NOCHANGE); @@ -1672,9 +1635,7 @@ void format_gui_flags(GString *out, int *last_fg, int *last_bg, int *last_flags, } else { format_ext_color(out, 1, bg); } -#ifdef TERM_TRUECOLOR } -#endif } if ((flags & GUI_PRINT_FLAG_UNDERLINE) != (*last_flags & GUI_PRINT_FLAG_UNDERLINE)) { diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h index 5666c73b..79b90ded 100644 --- a/src/fe-common/core/formats.h +++ b/src/fe-common/core/formats.h @@ -158,9 +158,7 @@ void format_send_as_gui_flags(TEXT_DEST_REC *dest, const char *text, SIGNAL_FUNC #define FORMAT_COLOR_EXT1_BG ('0'-5) #define FORMAT_COLOR_EXT2_BG ('0'-9) #define FORMAT_COLOR_EXT3_BG ('0'-10) -#ifdef TERM_TRUECOLOR #define FORMAT_COLOR_24 ('0'-13) -#endif #define FORMAT_STYLE_SPECIAL 0x60 #define FORMAT_STYLE_BLINK (0x01 + FORMAT_STYLE_SPECIAL) diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 5050c800..ad362f20 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -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; } } diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index d317456b..2091b5a3 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -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]; diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 78496a64..5e9ead8a 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -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) diff --git a/src/fe-text/term.c b/src/fe-text/term.c index 1d5c2bef..5587fe20 100644 --- a/src/fe-text/term.c +++ b/src/fe-text/term.c @@ -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)) { diff --git a/src/fe-text/term.h b/src/fe-text/term.h index 7758fea3..601b12c6 100644 --- a/src/fe-text/term.h +++ b/src/fe-text/term.h @@ -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); diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index 79f3522c..0c89f600 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -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; } diff --git a/src/fe-text/textbuffer-view.h b/src/fe-text/textbuffer-view.h index 4e5ed82f..cdd3cbe5 100644 --- a/src/fe-text/textbuffer-view.h +++ b/src/fe-text/textbuffer-view.h @@ -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 */