console: rename font_char_attr to kmscon_console_attr
This removes this legacy name and also moves the attribute structure into the console subsystem where it belongs. This currently creates circular dependencies between text and console layers but we can ignore that for now and fix it later. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
52c57a51b6
commit
4250cffd6c
@ -46,7 +46,7 @@
|
||||
|
||||
struct cell {
|
||||
kmscon_symbol_t ch;
|
||||
struct font_char_attr attr;
|
||||
struct kmscon_console_attr attr;
|
||||
};
|
||||
|
||||
struct line {
|
||||
@ -63,7 +63,7 @@ struct kmscon_console {
|
||||
struct kmscon_timer *timer;
|
||||
|
||||
/* default attributes for new cells */
|
||||
struct font_char_attr def_attr;
|
||||
struct kmscon_console_attr def_attr;
|
||||
|
||||
/* current buffer */
|
||||
unsigned int size_x;
|
||||
@ -319,7 +319,7 @@ static void console_scroll_down(struct kmscon_console *con, unsigned int num)
|
||||
|
||||
static void console_write(struct kmscon_console *con, unsigned int x,
|
||||
unsigned int y, kmscon_symbol_t ch,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
struct line *line;
|
||||
|
||||
@ -698,7 +698,7 @@ void kmscon_console_sb_reset(struct kmscon_console *con)
|
||||
}
|
||||
|
||||
void kmscon_console_set_def_attr(struct kmscon_console *con,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
if (!con || !attr)
|
||||
return;
|
||||
@ -798,7 +798,7 @@ void kmscon_console_draw(struct kmscon_console *con, struct kmscon_text *txt)
|
||||
unsigned int i, j, k;
|
||||
struct line *iter, *line = NULL;
|
||||
struct cell *cell;
|
||||
struct font_char_attr attr;
|
||||
struct kmscon_console_attr attr;
|
||||
bool cursor_done = false;
|
||||
int ret, warned = 0;
|
||||
uint64_t time_prep = 0, time_draw = 0, time_rend = 0;
|
||||
@ -900,7 +900,7 @@ void kmscon_console_draw(struct kmscon_console *con, struct kmscon_text *txt)
|
||||
}
|
||||
|
||||
void kmscon_console_write(struct kmscon_console *con, kmscon_symbol_t ch,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
unsigned int last;
|
||||
|
||||
|
@ -50,6 +50,19 @@ struct kmscon_console;
|
||||
#define KMSCON_CONSOLE_HIDE_CURSOR 0x10
|
||||
#define KMSCON_CONSOLE_FIXED_POS 0x20
|
||||
|
||||
struct kmscon_console_attr {
|
||||
uint8_t fr; /* foreground red */
|
||||
uint8_t fg; /* foreground green */
|
||||
uint8_t fb; /* foreground blue */
|
||||
uint8_t br; /* background red */
|
||||
uint8_t bg; /* background green */
|
||||
uint8_t bb; /* background blue */
|
||||
unsigned int bold : 1; /* bold character */
|
||||
unsigned int underline : 1; /* underlined character */
|
||||
unsigned int inverse : 1; /* inverse colors */
|
||||
unsigned int protect : 1; /* cannot be erased */
|
||||
};
|
||||
|
||||
int kmscon_console_new(struct kmscon_console **out);
|
||||
void kmscon_console_ref(struct kmscon_console *con);
|
||||
void kmscon_console_unref(struct kmscon_console *con);
|
||||
@ -70,7 +83,7 @@ void kmscon_console_sb_page_down(struct kmscon_console *con, unsigned int num);
|
||||
void kmscon_console_sb_reset(struct kmscon_console *con);
|
||||
|
||||
void kmscon_console_set_def_attr(struct kmscon_console *con,
|
||||
const struct font_char_attr *attr);
|
||||
const struct kmscon_console_attr *attr);
|
||||
void kmscon_console_reset(struct kmscon_console *con);
|
||||
void kmscon_console_set_flags(struct kmscon_console *con, unsigned int flags);
|
||||
void kmscon_console_reset_flags(struct kmscon_console *con, unsigned int flags);
|
||||
@ -83,10 +96,8 @@ void kmscon_console_set_tabstop(struct kmscon_console *con);
|
||||
void kmscon_console_reset_tabstop(struct kmscon_console *con);
|
||||
void kmscon_console_reset_all_tabstops(struct kmscon_console *con);
|
||||
|
||||
void kmscon_console_draw(struct kmscon_console *con, struct kmscon_text *txt);
|
||||
|
||||
void kmscon_console_write(struct kmscon_console *con, kmscon_symbol_t ch,
|
||||
const struct font_char_attr *attr);
|
||||
const struct kmscon_console_attr *attr);
|
||||
void kmscon_console_newline(struct kmscon_console *con);
|
||||
void kmscon_console_scroll_up(struct kmscon_console *con, unsigned int num);
|
||||
void kmscon_console_scroll_down(struct kmscon_console *con, unsigned int num);
|
||||
@ -120,4 +131,6 @@ void kmscon_console_erase_cursor_to_screen(struct kmscon_console *con,
|
||||
bool protect);
|
||||
void kmscon_console_erase_screen(struct kmscon_console *con, bool protect);
|
||||
|
||||
void kmscon_console_draw(struct kmscon_console *con, struct kmscon_text *txt);
|
||||
|
||||
#endif /* KMSCON_CONSOLE_H */
|
||||
|
@ -445,7 +445,7 @@ int kmscon_text_prepare(struct kmscon_text *txt)
|
||||
*/
|
||||
int kmscon_text_draw(struct kmscon_text *txt, kmscon_symbol_t ch,
|
||||
unsigned int posx, unsigned int posy,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
if (!txt || !txt->rendering)
|
||||
return -EINVAL;
|
||||
|
21
src/text.h
21
src/text.h
@ -40,25 +40,10 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include "console.h"
|
||||
#include "unicode.h"
|
||||
#include "uterm.h"
|
||||
|
||||
/* chars */
|
||||
|
||||
/* TODO: rename to kmscon_char_attr */
|
||||
struct font_char_attr {
|
||||
uint8_t fr; /* foreground red */
|
||||
uint8_t fg; /* foreground green */
|
||||
uint8_t fb; /* foreground blue */
|
||||
uint8_t br; /* background red */
|
||||
uint8_t bg; /* background green */
|
||||
uint8_t bb; /* background blue */
|
||||
unsigned int bold : 1; /* bold character */
|
||||
unsigned int underline : 1; /* underlined character */
|
||||
unsigned int inverse : 1; /* inverse colors */
|
||||
unsigned int protect : 1; /* cannot be erased */
|
||||
};
|
||||
|
||||
/* fonts */
|
||||
|
||||
struct kmscon_font_attr;
|
||||
@ -152,7 +137,7 @@ struct kmscon_text_ops {
|
||||
int (*prepare) (struct kmscon_text *txt);
|
||||
int (*draw) (struct kmscon_text *txt, kmscon_symbol_t ch,
|
||||
unsigned int posx, unsigned int posy,
|
||||
const struct font_char_attr *attr);
|
||||
const struct kmscon_console_attr *attr);
|
||||
int (*render) (struct kmscon_text *txt);
|
||||
void (*abort) (struct kmscon_text *txt);
|
||||
};
|
||||
@ -174,7 +159,7 @@ unsigned int kmscon_text_get_rows(struct kmscon_text *txt);
|
||||
int kmscon_text_prepare(struct kmscon_text *txt);
|
||||
int kmscon_text_draw(struct kmscon_text *txt, kmscon_symbol_t ch,
|
||||
unsigned int posx, unsigned int posy,
|
||||
const struct font_char_attr *attr);
|
||||
const struct kmscon_console_attr *attr);
|
||||
int kmscon_text_render(struct kmscon_text *txt);
|
||||
void kmscon_text_abort(struct kmscon_text *txt);
|
||||
|
||||
|
@ -61,7 +61,7 @@ static int bblit_set(struct kmscon_text *txt)
|
||||
|
||||
static int bblit_draw(struct kmscon_text *txt, kmscon_symbol_t ch,
|
||||
unsigned int posx, unsigned int posy,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
const struct kmscon_glyph *glyph;
|
||||
int ret;
|
||||
|
@ -113,7 +113,7 @@ static void bbulk_unset(struct kmscon_text *txt)
|
||||
|
||||
static int bbulk_draw(struct kmscon_text *txt, kmscon_symbol_t ch,
|
||||
unsigned int posx, unsigned int posy,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
struct bbulk *bb = txt->data;
|
||||
const struct kmscon_glyph *glyph;
|
||||
|
@ -522,7 +522,7 @@ static int gltex_prepare(struct kmscon_text *txt)
|
||||
|
||||
static int gltex_draw(struct kmscon_text *txt, kmscon_symbol_t ch,
|
||||
unsigned int posx, unsigned int posy,
|
||||
const struct font_char_attr *attr)
|
||||
const struct kmscon_console_attr *attr)
|
||||
{
|
||||
struct gltex *gt = txt->data;
|
||||
struct atlas *atlas;
|
||||
|
18
src/vte.c
18
src/vte.c
@ -138,7 +138,7 @@ enum parser_action {
|
||||
struct vte_saved_state {
|
||||
unsigned int cursor_x;
|
||||
unsigned int cursor_y;
|
||||
struct font_char_attr cattr;
|
||||
struct kmscon_console_attr cattr;
|
||||
kmscon_vte_charset *gl;
|
||||
kmscon_vte_charset *gr;
|
||||
bool wrap_mode;
|
||||
@ -160,8 +160,8 @@ struct kmscon_vte {
|
||||
unsigned int csi_flags;
|
||||
|
||||
uint8_t (*palette)[3];
|
||||
struct font_char_attr def_attr;
|
||||
struct font_char_attr cattr;
|
||||
struct kmscon_console_attr def_attr;
|
||||
struct kmscon_console_attr cattr;
|
||||
unsigned int flags;
|
||||
|
||||
kmscon_vte_charset *gl;
|
||||
@ -301,7 +301,7 @@ static uint8_t (*get_palette(void))[3]
|
||||
return color_palette;
|
||||
}
|
||||
|
||||
static void set_fcolor(struct font_char_attr *attr, unsigned int color,
|
||||
static void set_fcolor(struct kmscon_console_attr *attr, unsigned int color,
|
||||
struct kmscon_vte *vte)
|
||||
{
|
||||
if (color >= COLOR_NUM)
|
||||
@ -312,7 +312,7 @@ static void set_fcolor(struct font_char_attr *attr, unsigned int color,
|
||||
attr->fb = vte->palette[color][2];
|
||||
}
|
||||
|
||||
static void set_bcolor(struct font_char_attr *attr, unsigned int color,
|
||||
static void set_bcolor(struct kmscon_console_attr *attr, unsigned int color,
|
||||
struct kmscon_vte *vte)
|
||||
{
|
||||
if (color >= COLOR_NUM)
|
||||
@ -323,16 +323,16 @@ static void set_bcolor(struct font_char_attr *attr, unsigned int color,
|
||||
attr->bb = vte->palette[color][2];
|
||||
}
|
||||
|
||||
static void copy_fcolor(struct font_char_attr *dest,
|
||||
const struct font_char_attr *src)
|
||||
static void copy_fcolor(struct kmscon_console_attr *dest,
|
||||
const struct kmscon_console_attr *src)
|
||||
{
|
||||
dest->fr = src->fr;
|
||||
dest->fg = src->fg;
|
||||
dest->fb = src->fb;
|
||||
}
|
||||
|
||||
static void copy_bcolor(struct font_char_attr *dest,
|
||||
const struct font_char_attr *src)
|
||||
static void copy_bcolor(struct kmscon_console_attr *dest,
|
||||
const struct kmscon_console_attr *src)
|
||||
{
|
||||
dest->br = src->br;
|
||||
dest->bg = src->bg;
|
||||
|
Loading…
x
Reference in New Issue
Block a user