simplify setcolor/getcolor
This commit is contained in:
parent
d8e9099811
commit
3c151d94af
13 changed files with 54 additions and 185 deletions
|
@ -28,11 +28,5 @@ extern grub_uint8_t grub_console_cur_color;
|
|||
grub_uint16_t grub_console_getwh (struct grub_term_output *term);
|
||||
void grub_console_setcolorstate (struct grub_term_output *term,
|
||||
grub_term_color_state state);
|
||||
void grub_console_setcolor (struct grub_term_output *term,
|
||||
grub_uint8_t normal_color,
|
||||
grub_uint8_t highlight_color);
|
||||
void grub_console_getcolor (struct grub_term_output *term,
|
||||
grub_uint8_t *normal_color,
|
||||
grub_uint8_t *highlight_color);
|
||||
|
||||
#endif /* ! GRUB_VGA_COMMON_CPU_HEADER */
|
||||
|
|
|
@ -195,16 +195,6 @@ struct grub_term_output
|
|||
void (*setcolorstate) (struct grub_term_output *term,
|
||||
grub_term_color_state state);
|
||||
|
||||
/* Set the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
void (*setcolor) (struct grub_term_output *term,
|
||||
grub_uint8_t normal_color, grub_uint8_t highlight_color);
|
||||
|
||||
/* Get the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
void (*getcolor) (struct grub_term_output *term,
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
|
||||
|
||||
/* Turn on/off the cursor. */
|
||||
void (*setcursor) (struct grub_term_output *term, int on);
|
||||
|
||||
|
@ -214,10 +204,18 @@ struct grub_term_output
|
|||
/* The feature flags defined above. */
|
||||
grub_uint32_t flags;
|
||||
|
||||
/* Current color state. */
|
||||
grub_uint8_t normal_color;
|
||||
grub_uint8_t highlight_color;
|
||||
|
||||
void *data;
|
||||
};
|
||||
typedef struct grub_term_output *grub_term_output_t;
|
||||
|
||||
#define GRUB_TERM_DEFAULT_NORMAL_COLOR 0x07
|
||||
#define GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR 0x70
|
||||
#define GRUB_TERM_DEFAULT_STANDARD_COLOR 0x07
|
||||
|
||||
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs_disabled);
|
||||
extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled);
|
||||
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs);
|
||||
|
@ -361,14 +359,14 @@ grub_term_setcolorstate (struct grub_term_output *term,
|
|||
term->setcolorstate (term, state);
|
||||
}
|
||||
|
||||
/* Set the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
/* Set the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
static inline void
|
||||
grub_term_setcolor (struct grub_term_output *term,
|
||||
grub_uint8_t normal_color, grub_uint8_t highlight_color)
|
||||
{
|
||||
if (term->setcolor)
|
||||
term->setcolor (term, normal_color, highlight_color);
|
||||
term->normal_color = normal_color;
|
||||
term->highlight_color = highlight_color;
|
||||
}
|
||||
|
||||
/* Turn on/off the cursor. */
|
||||
|
@ -429,13 +427,8 @@ static inline void
|
|||
grub_term_getcolor (struct grub_term_output *term,
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
{
|
||||
if (term->getcolor)
|
||||
term->getcolor (term, normal_color, highlight_color);
|
||||
else
|
||||
{
|
||||
*normal_color = 0x07;
|
||||
*highlight_color = 0x07;
|
||||
}
|
||||
*normal_color = term->normal_color;
|
||||
*highlight_color = term->highlight_color;
|
||||
}
|
||||
|
||||
struct grub_term_autoload
|
||||
|
|
|
@ -49,9 +49,6 @@ struct grub_terminfo_output_state
|
|||
char *cursor_off;
|
||||
char *setcolor;
|
||||
|
||||
grub_uint8_t normal_color;
|
||||
grub_uint8_t highlight_color;
|
||||
|
||||
unsigned int xpos, ypos;
|
||||
|
||||
void (*put) (const int c);
|
||||
|
@ -72,12 +69,6 @@ grub_err_t EXPORT_FUNC (grub_terminfo_input_init) (struct grub_term_input *term)
|
|||
int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term);
|
||||
void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
void EXPORT_FUNC (grub_terminfo_getcolor) (struct grub_term_output *term,
|
||||
grub_uint8_t *normal_color,
|
||||
grub_uint8_t *highlight_color);
|
||||
void EXPORT_FUNC (grub_terminfo_setcolor) (struct grub_term_output *term,
|
||||
grub_uint8_t normal_color,
|
||||
grub_uint8_t highlight_color);
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term,
|
||||
const char *type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue