mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04: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:
commit
3a5f93bbcc
1
.github/workflows/termuxpkg.yml
vendored
1
.github/workflows/termuxpkg.yml
vendored
@ -37,7 +37,6 @@ jobs:
|
|||||||
TERMUX_PKG_BREAKS="irssi"
|
TERMUX_PKG_BREAKS="irssi"
|
||||||
TERMUX_PKG_REPLACES="irssi"
|
TERMUX_PKG_REPLACES="irssi"
|
||||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||||
-Denable-true-color=yes
|
|
||||||
-Dfhs-prefix=$TERMUX_PREFIX
|
-Dfhs-prefix=$TERMUX_PREFIX
|
||||||
"
|
"
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ want_fuzzer = get_option('with-fuzzer') == 'yes'
|
|||||||
fuzzer_lib = get_option('with-fuzzer-lib')
|
fuzzer_lib = get_option('with-fuzzer-lib')
|
||||||
fuzzer_link_language = get_option('fuzzer-link-language')
|
fuzzer_link_language = get_option('fuzzer-link-language')
|
||||||
want_proxy = get_option('with-proxy') == 'yes'
|
want_proxy = get_option('with-proxy') == 'yes'
|
||||||
want_truecolor = get_option('enable-true-color') == 'yes'
|
|
||||||
want_gregex = get_option('disable-gregex') != 'yes'
|
want_gregex = get_option('disable-gregex') != 'yes'
|
||||||
|
|
||||||
require_capsicum = get_option('with-capsicum') == '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_CAPSICUM', have_capsicum, description : 'Build with Capsicum support')
|
||||||
conf.set('HAVE_GMODULE', true)
|
conf.set('HAVE_GMODULE', true)
|
||||||
conf.set('HAVE_SOCKS', false, description : 'Build with socks support')
|
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.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.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'))
|
conf.set_quoted('FHS_PREFIX', get_option('fhs-prefix'))
|
||||||
@ -627,7 +626,6 @@ if have_perl
|
|||||||
endif
|
endif
|
||||||
message('Install prefix ................... : ' + get_option('prefix'))
|
message('Install prefix ................... : ' + get_option('prefix'))
|
||||||
message('')
|
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 GRegex ............. : ' + want_gregex.to_string('yes', 'no'))
|
||||||
message('Building with Capsicum ........... : ' + have_capsicum.to_string('yes', 'no'))
|
message('Building with Capsicum ........... : ' + have_capsicum.to_string('yes', 'no'))
|
||||||
message('Building with utf8proc ........... : ' + have_libutf8proc.to_string('yes', 'no'))
|
message('Building with utf8proc ........... : ' + have_libutf8proc.to_string('yes', 'no'))
|
||||||
|
@ -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-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-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('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-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('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'])
|
option('with-capsicum', type : 'combo', description : 'Build with Capsicum support', choices : ['auto', 'yes', 'no'])
|
||||||
|
@ -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]);
|
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)
|
void unformat_24bit_color(char **ptr, int off, int *fgcolor, int *bgcolor, int *flags)
|
||||||
{
|
{
|
||||||
unsigned int color;
|
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_c(out, rgbx[3] & 0x1 ? 'z' : 'Z');
|
||||||
g_string_append_printf(out, "%06X", color);
|
g_string_append_printf(out, "%06X", color);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void format_24bit_color(GString *out, int bg, unsigned int color)
|
void format_24bit_color(GString *out, int bg, unsigned int color)
|
||||||
{
|
{
|
||||||
unsigned char rgb[] = { color >> 16, color >> 8, color };
|
unsigned char rgb[] = { color >> 16, color >> 8, color };
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
unsigned char x = bg ? 0x1 : 0;
|
unsigned char x = bg ? 0x1 : 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
g_string_append_c(out, 4);
|
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);
|
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)
|
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:
|
case FORMAT_COLOR_EXT3_BG:
|
||||||
format_ext_color_unexpand(out, TRUE, 0xb0, *++text);
|
format_ext_color_unexpand(out, TRUE, 0xb0, *++text);
|
||||||
break;
|
break;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
case FORMAT_COLOR_24:
|
case FORMAT_COLOR_24:
|
||||||
format_24bit_color_unexpand(out, 1, &text);
|
format_24bit_color_unexpand(out, 1, &text);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case FORMAT_STYLE_BLINK:
|
case FORMAT_STYLE_BLINK:
|
||||||
format_flag_unexpand(out, 'F');
|
format_flag_unexpand(out, 'F');
|
||||||
break;
|
break;
|
||||||
@ -1057,13 +1049,6 @@ void format_newline(TEXT_DEST_REC *dest)
|
|||||||
GINT_TO_POINTER(-1), GINT_TO_POINTER(GUI_PRINT_FLAG_NEWLINE), "", 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 */
|
/* parse ANSI color string */
|
||||||
static const char *get_ansi_color(THEME_REC *theme, const char *str,
|
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;
|
if (i == -1) break;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (num == 38) {
|
if (num == 38) {
|
||||||
flags |= GUI_PRINT_FLAG_COLOR_24_FG;
|
flags |= GUI_PRINT_FLAG_COLOR_24_FG;
|
||||||
fg = num2;
|
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;
|
flags |= GUI_PRINT_FLAG_COLOR_24_BG;
|
||||||
bg = num2;
|
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;
|
break;
|
||||||
case 5:
|
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
|
/* We expect 4 to indicate an internal Irssi color code. However 4
|
||||||
* also means hex color, an alternative to mIRC color codes. We
|
* also means hex color, an alternative to mIRC color codes. We
|
||||||
* don't support those. */
|
* don't support those. */
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (str[1] == FORMAT_COLOR_24 && str[2] != '\0') {
|
if (str[1] == FORMAT_COLOR_24 && str[2] != '\0') {
|
||||||
if (str[3] == '\0') str++;
|
if (str[3] == '\0') str++;
|
||||||
else if (str[4] == '\0') str += 2;
|
else if (str[4] == '\0') str += 2;
|
||||||
@ -1344,9 +1319,7 @@ int strip_real_length(const char *str, int len,
|
|||||||
*last_color_len = 6;
|
*last_color_len = 6;
|
||||||
str+=4;
|
str+=4;
|
||||||
}
|
}
|
||||||
} else
|
} else if (str[1] < FORMAT_STYLE_SPECIAL && str[2] != '\0') {
|
||||||
#endif
|
|
||||||
if (str[1] < FORMAT_STYLE_SPECIAL && str[2] != '\0') {
|
|
||||||
if (last_color_pos != NULL)
|
if (last_color_pos != NULL)
|
||||||
*last_color_pos = (int) (str-start);
|
*last_color_pos = (int) (str-start);
|
||||||
if (last_color_len != NULL)
|
if (last_color_len != NULL)
|
||||||
@ -1395,14 +1368,12 @@ char *strip_codes(const char *input)
|
|||||||
|
|
||||||
/* irssi color */
|
/* irssi color */
|
||||||
if (p[2] != '\0') {
|
if (p[2] != '\0') {
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (p[1] == FORMAT_COLOR_24) {
|
if (p[1] == FORMAT_COLOR_24) {
|
||||||
if (p[3] == '\0') p += 2;
|
if (p[3] == '\0') p += 2;
|
||||||
else if (p[4] == '\0') p += 3;
|
else if (p[4] == '\0') p += 3;
|
||||||
else if (p[5] == '\0') p += 4;
|
else if (p[5] == '\0') p += 4;
|
||||||
else p += 5;
|
else p += 5;
|
||||||
} else
|
} else
|
||||||
#endif /* TERM_TRUECOLOR */
|
|
||||||
p += 2;
|
p += 2;
|
||||||
continue;
|
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;
|
bgcolor = 0xb0 + *++ptr - FORMAT_COLOR_NOCHANGE;
|
||||||
flags &= ~GUI_PRINT_FLAG_COLOR_24_BG;
|
flags &= ~GUI_PRINT_FLAG_COLOR_24_BG;
|
||||||
break;
|
break;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
case FORMAT_COLOR_24:
|
case FORMAT_COLOR_24:
|
||||||
unformat_24bit_color(&ptr, 1, &fgcolor, &bgcolor, &flags);
|
unformat_24bit_color(&ptr, 1, &fgcolor, &bgcolor, &flags);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
if (*ptr != FORMAT_COLOR_NOCHANGE) {
|
if (*ptr != FORMAT_COLOR_NOCHANGE) {
|
||||||
flags &= ~GUI_PRINT_FLAG_COLOR_24_FG;
|
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)) {
|
(flags & GUI_PRINT_FLAG_COLOR_24_FG) != (*last_flags & GUI_PRINT_FLAG_COLOR_24_FG)) {
|
||||||
*last_fg = fg;
|
*last_fg = fg;
|
||||||
|
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (flags & GUI_PRINT_FLAG_COLOR_24_FG) {
|
if (flags & GUI_PRINT_FLAG_COLOR_24_FG) {
|
||||||
*last_flags |= GUI_PRINT_FLAG_COLOR_24_FG;
|
*last_flags |= GUI_PRINT_FLAG_COLOR_24_FG;
|
||||||
format_24bit_color(out, 0, fg);
|
format_24bit_color(out, 0, fg);
|
||||||
} else {
|
} else {
|
||||||
*last_flags &= ~GUI_PRINT_FLAG_COLOR_24_FG;
|
*last_flags &= ~GUI_PRINT_FLAG_COLOR_24_FG;
|
||||||
#endif
|
|
||||||
if (fg < 0) {
|
if (fg < 0) {
|
||||||
g_string_append_c(out, 4);
|
g_string_append_c(out, 4);
|
||||||
g_string_append_c(out, (char) -1);
|
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 {
|
} else {
|
||||||
format_ext_color(out, 0, fg);
|
format_ext_color(out, 0, fg);
|
||||||
}
|
}
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (bg != *last_bg ||
|
if (bg != *last_bg ||
|
||||||
(flags & GUI_PRINT_FLAG_COLOR_24_BG) != (*last_flags & GUI_PRINT_FLAG_COLOR_24_BG)) {
|
(flags & GUI_PRINT_FLAG_COLOR_24_BG) != (*last_flags & GUI_PRINT_FLAG_COLOR_24_BG)) {
|
||||||
*last_bg = bg;
|
*last_bg = bg;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (flags & GUI_PRINT_FLAG_COLOR_24_BG) {
|
if (flags & GUI_PRINT_FLAG_COLOR_24_BG) {
|
||||||
*last_flags |= GUI_PRINT_FLAG_COLOR_24_BG;
|
*last_flags |= GUI_PRINT_FLAG_COLOR_24_BG;
|
||||||
format_24bit_color(out, 1, bg);
|
format_24bit_color(out, 1, bg);
|
||||||
} else {
|
} else {
|
||||||
*last_flags &= ~GUI_PRINT_FLAG_COLOR_24_BG;
|
*last_flags &= ~GUI_PRINT_FLAG_COLOR_24_BG;
|
||||||
#endif
|
|
||||||
if (bg < 0) {
|
if (bg < 0) {
|
||||||
g_string_append_c(out, 4);
|
g_string_append_c(out, 4);
|
||||||
g_string_append_c(out, FORMAT_COLOR_NOCHANGE);
|
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 {
|
} else {
|
||||||
format_ext_color(out, 1, bg);
|
format_ext_color(out, 1, bg);
|
||||||
}
|
}
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & GUI_PRINT_FLAG_UNDERLINE) != (*last_flags & GUI_PRINT_FLAG_UNDERLINE)) {
|
if ((flags & GUI_PRINT_FLAG_UNDERLINE) != (*last_flags & GUI_PRINT_FLAG_UNDERLINE)) {
|
||||||
|
@ -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_EXT1_BG ('0'-5)
|
||||||
#define FORMAT_COLOR_EXT2_BG ('0'-9)
|
#define FORMAT_COLOR_EXT2_BG ('0'-9)
|
||||||
#define FORMAT_COLOR_EXT3_BG ('0'-10)
|
#define FORMAT_COLOR_EXT3_BG ('0'-10)
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
#define FORMAT_COLOR_24 ('0'-13)
|
#define FORMAT_COLOR_24 ('0'-13)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FORMAT_STYLE_SPECIAL 0x60
|
#define FORMAT_STYLE_SPECIAL 0x60
|
||||||
#define FORMAT_STYLE_BLINK (0x01 + FORMAT_STYLE_SPECIAL)
|
#define FORMAT_STYLE_BLINK (0x01 + FORMAT_STYLE_SPECIAL)
|
||||||
|
@ -300,7 +300,6 @@ static char *text_effects_only(const char *p)
|
|||||||
|
|
||||||
/* irssi color */
|
/* irssi color */
|
||||||
if (p[2] != '\0') {
|
if (p[2] != '\0') {
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (p[1] == FORMAT_COLOR_24) {
|
if (p[1] == FORMAT_COLOR_24) {
|
||||||
if (p[3] == '\0') p += 2;
|
if (p[3] == '\0') p += 2;
|
||||||
else if (p[4] == '\0') p += 3;
|
else if (p[4] == '\0') p += 3;
|
||||||
@ -310,12 +309,9 @@ static char *text_effects_only(const char *p)
|
|||||||
p += 5;
|
p += 5;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif /* TERM_TRUECOLOR */
|
|
||||||
g_string_append_len(str, p, 3);
|
g_string_append_len(str, p, 3);
|
||||||
p += 2;
|
p += 2;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
}
|
}
|
||||||
#endif /* TERM_TRUECOLOR */
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,9 +245,7 @@ void gui_printtext_get_colors(int *flags, int *fg, int *bg, int *attr)
|
|||||||
if (*flags & GUI_PRINT_FLAG_MIRC_COLOR) {
|
if (*flags & GUI_PRINT_FLAG_MIRC_COLOR) {
|
||||||
/* mirc colors - extended colours proposal */
|
/* mirc colors - extended colours proposal */
|
||||||
gboolean use_24_map = FALSE;
|
gboolean use_24_map = FALSE;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
use_24_map = settings_get_bool("colors_ansi_24bit");
|
use_24_map = settings_get_bool("colors_ansi_24bit");
|
||||||
#endif
|
|
||||||
if (*bg >= 0) {
|
if (*bg >= 0) {
|
||||||
if (use_24_map && mirc_colors24[*bg % 100] != -1) {
|
if (use_24_map && mirc_colors24[*bg % 100] != -1) {
|
||||||
*bg = mirc_colors24[*bg % 100];
|
*bg = mirc_colors24[*bg % 100];
|
||||||
|
@ -339,33 +339,25 @@ static int termctl_set_color_24bit(int bg, unsigned int lc)
|
|||||||
#define COLOR_BLACK24 COLOR_RESET - 1
|
#define COLOR_BLACK24 COLOR_RESET - 1
|
||||||
|
|
||||||
/* Change active color */
|
/* Change active color */
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigned int bgcol24)
|
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;
|
int set_normal;
|
||||||
|
|
||||||
unsigned int fg, bg;
|
unsigned int fg, bg;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (col & ATTR_FGCOLOR24) {
|
if (col & ATTR_FGCOLOR24) {
|
||||||
if (fgcol24)
|
if (fgcol24)
|
||||||
fg = fgcol24 << 8;
|
fg = fgcol24 << 8;
|
||||||
else
|
else
|
||||||
fg = COLOR_BLACK24;
|
fg = COLOR_BLACK24;
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
fg = (col & FG_MASK);
|
fg = (col & FG_MASK);
|
||||||
|
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
if (col & ATTR_BGCOLOR24) {
|
if (col & ATTR_BGCOLOR24) {
|
||||||
if (bgcol24)
|
if (bgcol24)
|
||||||
bg = bgcol24 << 8;
|
bg = bgcol24 << 8;
|
||||||
else
|
else
|
||||||
bg = COLOR_BLACK24;
|
bg = COLOR_BLACK24;
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
bg = ((col & BG_MASK) >> BG_SHIFT);
|
bg = ((col & BG_MASK) >> BG_SHIFT);
|
||||||
|
|
||||||
if (!term_use_colors && bg > 0)
|
if (!term_use_colors && bg > 0)
|
||||||
|
@ -150,12 +150,8 @@ static void read_settings(void)
|
|||||||
term_use_colors = settings_get_bool("colors") &&
|
term_use_colors = settings_get_bool("colors") &&
|
||||||
(force_colors || term_has_colors());
|
(force_colors || term_has_colors());
|
||||||
|
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
term_use_colors24 = settings_get_bool("colors_ansi_24bit") &&
|
term_use_colors24 = settings_get_bool("colors_ansi_24bit") &&
|
||||||
(force_colors || term_has_colors());
|
(force_colors || term_has_colors());
|
||||||
#else
|
|
||||||
term_use_colors24 = FALSE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (term_use_colors != old_colors || term_use_colors24 != old_colors24)
|
if (term_use_colors != old_colors || term_use_colors24 != old_colors24)
|
||||||
irssi_redraw();
|
irssi_redraw();
|
||||||
@ -173,12 +169,8 @@ void term_common_init(void)
|
|||||||
|
|
||||||
force_colors = FALSE;
|
force_colors = FALSE;
|
||||||
term_use_colors = term_has_colors() && settings_get_bool("colors");
|
term_use_colors = term_has_colors() && settings_get_bool("colors");
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
settings_add_bool("lookandfeel", "colors_ansi_24bit", FALSE);
|
settings_add_bool("lookandfeel", "colors_ansi_24bit", FALSE);
|
||||||
term_use_colors24 = term_has_colors() && settings_get_bool("colors_ansi_24bit");
|
term_use_colors24 = term_has_colors() && settings_get_bool("colors_ansi_24bit");
|
||||||
#else
|
|
||||||
term_use_colors24 = FALSE;
|
|
||||||
#endif
|
|
||||||
read_settings();
|
read_settings();
|
||||||
|
|
||||||
if (g_get_charset(&dummy)) {
|
if (g_get_charset(&dummy)) {
|
||||||
|
@ -72,13 +72,8 @@ void term_window_clear(TERM_WINDOW *window);
|
|||||||
/* Scroll window up/down */
|
/* Scroll window up/down */
|
||||||
void term_window_scroll(TERM_WINDOW *window, int count);
|
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)
|
#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);
|
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_move(TERM_WINDOW *window, int x, int y);
|
||||||
void term_addch(TERM_WINDOW *window, char chr);
|
void term_addch(TERM_WINDOW *window, char chr);
|
||||||
|
@ -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 FGATTR (ATTR_NOCOLORS | ATTR_RESETFG | FG_MASK | ATTR_FGCOLOR24)
|
||||||
#define BGATTR (ATTR_NOCOLORS | ATTR_RESETBG | BG_MASK | ATTR_BGCOLOR24)
|
#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)
|
static void unformat_24bit_line_color(const unsigned char **ptr, int off, int *flags, unsigned int *fg, unsigned int *bg)
|
||||||
{
|
{
|
||||||
unsigned int color;
|
unsigned int color;
|
||||||
@ -145,7 +144,6 @@ static void unformat_24bit_line_color(const unsigned char **ptr, int off, int *f
|
|||||||
*fg = color;
|
*fg = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline unichar read_unichar(const unsigned char *data, const unsigned char **next, int *width)
|
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;
|
break;
|
||||||
#undef SET_COLOR_EXT_BG_BITS
|
#undef SET_COLOR_EXT_BG_BITS
|
||||||
#undef SET_COLOR_EXT_FG_BITS
|
#undef SET_COLOR_EXT_FG_BITS
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
case FORMAT_COLOR_24:
|
case FORMAT_COLOR_24:
|
||||||
unformat_24bit_line_color(ptr, 1, color, fg24, bg24);
|
unformat_24bit_line_color(ptr, 1, color, fg24, bg24);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
if (**ptr != FORMAT_COLOR_NOCHANGE) {
|
if (**ptr != FORMAT_COLOR_NOCHANGE) {
|
||||||
if (**ptr == (unsigned char) 0xff) {
|
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->start = ++ptr;
|
||||||
sub->color = color;
|
sub->color = color;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
sub->fg24 = fg24;
|
sub->fg24 = fg24;
|
||||||
sub->bg24 = bg24;
|
sub->bg24 = bg24;
|
||||||
#endif
|
|
||||||
|
|
||||||
lines = g_slist_append(lines, sub);
|
lines = g_slist_append(lines, sub);
|
||||||
linecount++;
|
linecount++;
|
||||||
@ -360,10 +354,8 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
|||||||
sub->indent = xpos;
|
sub->indent = xpos;
|
||||||
sub->indent_func = indent_func;
|
sub->indent_func = indent_func;
|
||||||
sub->color = color;
|
sub->color = color;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
sub->fg24 = fg24;
|
sub->fg24 = fg24;
|
||||||
sub->bg24 = bg24;
|
sub->bg24 = bg24;
|
||||||
#endif
|
|
||||||
|
|
||||||
lines = g_slist_append(lines, sub);
|
lines = g_slist_append(lines, sub);
|
||||||
linecount++;
|
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)
|
if (indent_func == NULL || cache->lines[subline-1].continues)
|
||||||
xpos = cache->lines[subline-1].indent;
|
xpos = cache->lines[subline-1].indent;
|
||||||
color = cache->lines[subline-1].color;
|
color = cache->lines[subline-1].color;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
fg24 = cache->lines[subline-1].fg24;
|
fg24 = cache->lines[subline-1].fg24;
|
||||||
bg24 = cache->lines[subline-1].bg24;
|
bg24 = cache->lines[subline-1].bg24;
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
indent_func = NULL;
|
indent_func = NULL;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@ typedef struct {
|
|||||||
int indent;
|
int indent;
|
||||||
INDENT_FUNC indent_func;
|
INDENT_FUNC indent_func;
|
||||||
int color;
|
int color;
|
||||||
#ifdef TERM_TRUECOLOR
|
|
||||||
unsigned int fg24, bg24;
|
unsigned int fg24, bg24;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* first word in line belong to the end of the last word in
|
/* first word in line belong to the end of the last word in
|
||||||
previous line */
|
previous line */
|
||||||
|
Loading…
Reference in New Issue
Block a user