1
0
mirror of https://github.com/irssi/irssi.git synced 2024-07-21 03:14:16 -04:00

Merge pull request #69 from ailin-nemui/always-24bit

remove enable-true-color compile time switch
This commit is contained in:
ailin-nemui 2022-02-19 22:45:37 +01:00 committed by GitHub
commit 3a5f93bbcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 3 additions and 87 deletions

View File

@ -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
"

View File

@ -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'))

View File

@ -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'])

View File

@ -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)) {

View File

@ -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)

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 */