1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

[colors] Compilation fixes. Refs #142

This commit is contained in:
Witold Filipczyk 2022-03-22 19:11:23 +01:00
parent 3c8026be54
commit 27ca62762c
2 changed files with 43 additions and 24 deletions

View File

@ -75,10 +75,12 @@ get_bfu_color88_node(unsigned int node_number)
{
struct bfu_color_entry *entry = node_entries[node_number];
#ifdef CONFIG_88_COLORS
if (!entry->was_color88) {
set_term_color(&entry->c88, &entry->colors, 0, COLOR_MODE_88);
entry->was_color88 = 1;
}
#endif
return &entry->c88;
}
@ -88,10 +90,12 @@ get_bfu_color256_node(unsigned int node_number)
{
struct bfu_color_entry *entry = node_entries[node_number];
#ifdef CONFIG_256_COLORS
if (!entry->was_color256) {
set_term_color(&entry->c256, &entry->colors, 0, COLOR_MODE_256);
entry->was_color256 = 1;
}
#endif
return &entry->c256;
}
@ -101,10 +105,12 @@ get_bfu_true_color_node(unsigned int node_number)
{
struct bfu_color_entry *entry = node_entries[node_number];
#ifdef CONFIG_TRUE_COLOR
if (!entry->was_color24) {
set_term_color(&entry->c24, &entry->colors, 0, COLOR_MODE_TRUE_COLOR);
entry->was_color24 = 1;
}
#endif
return &entry->c24;
}

View File

@ -445,9 +445,18 @@ static INIT_LIST_OF(struct screen_driver, active_screen_drivers);
static struct screen_char *get_mono_from_node(struct screen_char *ch);
static struct screen_char *get_color16_from_node(struct screen_char *ch);
#ifdef CONFIG_88_COLORS
static struct screen_char *get_color88_from_node(struct screen_char *ch);
#endif
#ifdef CONFIG_256_COLORS
static struct screen_char *get_color256_from_node(struct screen_char *ch);
#endif
#ifdef CONFIG_TRUE_COLOR
static struct screen_char *get_true_color_from_node(struct screen_char *ch);
#endif
/** Set screen_driver.opt according to screen_driver.type and @a term_spec.
* Other members of @a *driver need not have been initialized.
@ -875,6 +884,30 @@ add_char_data(struct string *screen, struct screen_driver *driver,
}
}
static struct screen_char *
get_mono_from_node(struct screen_char *ch)
{
unsigned int node_number = ch->c.node_number;
if (node_number < 1024) {
return get_bfu_mono_node(node_number);
}
return ch;
}
static struct screen_char *
get_color16_from_node(struct screen_char *ch)
{
unsigned int node_number = ch->c.node_number;
if (node_number < 1024) {
return get_bfu_color16_node(node_number);
}
return ch;
}
/** Time critical section. */
static inline void
add_char16(struct string *screen, struct screen_driver *driver,
@ -1087,6 +1120,7 @@ add_char_color(struct string *screen, const struct string *seq, unsigned char co
add_bytes_to_string(screen, &seq->source[seq_pos], seq->length - seq_pos);
}
#ifdef CONFIG_256_COLORS
static struct screen_char *
get_color256_from_node(struct screen_char *ch)
{
@ -1098,7 +1132,9 @@ get_color256_from_node(struct screen_char *ch)
return ch;
}
#endif
#ifdef CONFIG_88_COLORS
static struct screen_char *
get_color88_from_node(struct screen_char *ch)
{
@ -1110,32 +1146,9 @@ get_color88_from_node(struct screen_char *ch)
return ch;
}
#endif
static struct screen_char *
get_mono_from_node(struct screen_char *ch)
{
unsigned int node_number = ch->c.node_number;
if (node_number < 1024) {
return get_bfu_mono_node(node_number);
}
return ch;
}
static struct screen_char *
get_color16_from_node(struct screen_char *ch)
{
unsigned int node_number = ch->c.node_number;
if (node_number < 1024) {
return get_bfu_color16_node(node_number);
}
return ch;
}
#define add_background_color(str, seq, chr) add_char_color(str, &(seq)[1], (chr)->c.color[1])
#define add_foreground_color(str, seq, chr) add_char_color(str, &(seq)[0], (chr)->c.color[0])