diff options
author | marius <marius@FreeBSD.org> | 2014-06-30 09:59:23 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2014-06-30 09:59:23 +0000 |
commit | 618ac05759258204b881c19e2ddbe3955e5a1140 (patch) | |
tree | 490faff01aad74d3bbd5571161ecea69857c7cae /sys/kern/subr_terminal.c | |
parent | fa72c237e4d9a4d5abcedfa528f932e33fbfecdf (diff) | |
download | FreeBSD-src-618ac05759258204b881c19e2ddbe3955e5a1140.zip FreeBSD-src-618ac05759258204b881c19e2ddbe3955e5a1140.tar.gz |
MFC: r267978
In order to get vt(4) a bit closer to the feature set provided by sc(4),
implement options TERMINAL_{KERN,NORM}_ATTR. These are aliased to
SC_{KERNEL_CONS,NORM}_ATTR and like these latter, allow to change the
default colors of normal and kernel text respectively.
Note on the naming: Although affecting the output of vt(4), technically
kern/subr_terminal.c is primarily concerned with changing default colors
so it would be inconsistent to term these options VT_{KERN,NORM}_ATTR.
Actually, if the architecture and abstraction of terminal+teken+vt would
be perfect, dev/vt/* wouldn't be touched by this commit at all.
Reviewed by: emaste
Sponsored by: Bally Wulff Games & Entertainment GmbH
Diffstat (limited to 'sys/kern/subr_terminal.c')
-rw-r--r-- | sys/kern/subr_terminal.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/kern/subr_terminal.c b/sys/kern/subr_terminal.c index 5f8ffec..d8d1836 100644 --- a/sys/kern/subr_terminal.c +++ b/sys/kern/subr_terminal.c @@ -119,20 +119,20 @@ static teken_funcs_t terminal_drawmethods = { /* Kernel message formatting. */ static const teken_attr_t kernel_message = { - .ta_fgcolor = TC_WHITE, - .ta_bgcolor = TC_BLACK, - .ta_format = TF_BOLD, + .ta_fgcolor = TCHAR_FGCOLOR(TERMINAL_KERN_ATTR), + .ta_bgcolor = TCHAR_BGCOLOR(TERMINAL_KERN_ATTR), + .ta_format = TCHAR_FORMAT(TERMINAL_KERN_ATTR) }; static const teken_attr_t default_message = { - .ta_fgcolor = TC_WHITE, - .ta_bgcolor = TC_BLACK, + .ta_fgcolor = TCHAR_FGCOLOR(TERMINAL_NORM_ATTR), + .ta_bgcolor = TCHAR_BGCOLOR(TERMINAL_NORM_ATTR), + .ta_format = TCHAR_FORMAT(TERMINAL_NORM_ATTR) }; -#define TCHAR_CREATE(c, a) ((c) | \ - (a)->ta_format << 21 | \ - teken_256to8((a)->ta_fgcolor) << 26 | \ - teken_256to8((a)->ta_bgcolor) << 29) +#define TCHAR_CREATE(c, a) ((c) | TFORMAT((a)->ta_format) | \ + TCOLOR_FG(teken_256to8((a)->ta_fgcolor)) | \ + TCOLOR_BG(teken_256to8((a)->ta_bgcolor))) static void terminal_init(struct terminal *tm) @@ -191,7 +191,7 @@ terminal_maketty(struct terminal *tm, const char *fmt, ...) void terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, - int blank) + int blank, const term_attr_t *attr) { term_rect_t r; @@ -209,8 +209,8 @@ terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, TERMINAL_UNLOCK(tm); if ((blank != 0) && !(tm->tm_flags & TF_MUTE)) - tm->tm_class->tc_fill(tm, &r, TCHAR_CREATE((teken_char_t)' ', - &default_message)); + tm->tm_class->tc_fill(tm, &r, + TCHAR_CREATE((teken_char_t)' ', attr)); terminal_sync_ttysize(tm); } @@ -219,7 +219,8 @@ void terminal_set_winsize(struct terminal *tm, const struct winsize *size) { - terminal_set_winsize_blank(tm, size, 1); + terminal_set_winsize_blank(tm, size, 1, + (const term_attr_t *)&default_message); } /* |