From ec9037a258e06611e48e211a88c5fadf3a331e5d Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Sat, 17 Jan 2009 22:53:53 +0000 Subject: [PATCH] Make vidcontrol's color setting work again. It turns out I forgot to implement two escape sequences that allows the user to change the default foreground and background colors. I thought they were implemented by syscons itself, but vidcontrol just generates some escape sequences, which get interpreted by the terminal emulator. Reported by: mgp (forums) --- sys/dev/syscons/teken/sequences | 2 ++ sys/dev/syscons/teken/teken_subr_compat.h | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/sys/dev/syscons/teken/sequences b/sys/dev/syscons/teken/sequences index eb5a9fef54f..99aa226ab97 100644 --- a/sys/dev/syscons/teken/sequences +++ b/sys/dev/syscons/teken/sequences @@ -100,6 +100,8 @@ TBC Tab Clear ^[ [ g r VPA Vertical Position Absolute ^[ [ d n # Cons25 compatibility sequences +C25ADBG Cons25 set adapter background ^[ [ = G r +C25ADFG Cons25 set adapter foreground ^[ [ = F r C25CURS Cons25 set cursor type ^[ [ = S r C25VTSW Cons25 switch virtual terminal ^[ [ z r diff --git a/sys/dev/syscons/teken/teken_subr_compat.h b/sys/dev/syscons/teken/teken_subr_compat.h index 5378bb0a966..dea30d3e801 100644 --- a/sys/dev/syscons/teken/teken_subr_compat.h +++ b/sys/dev/syscons/teken/teken_subr_compat.h @@ -33,6 +33,29 @@ teken_subr_cons25_set_cursor_type(teken_t *t, unsigned int type) teken_funcs_param(t, TP_SHOWCURSOR, type != 1); } +static void +teken_subr_cons25_set_adapter_background(teken_t *t, unsigned int c) +{ + + t->t_defattr.ta_bgcolor = c % 8; + t->t_curattr.ta_bgcolor = c % 8; +} + +static void +teken_subr_cons25_set_adapter_foreground(teken_t *t, unsigned int c) +{ + + t->t_defattr.ta_fgcolor = c % 8; + t->t_curattr.ta_fgcolor = c % 8; + if (c >= 8) { + t->t_defattr.ta_format |= TF_BOLD; + t->t_curattr.ta_format |= TF_BOLD; + } else { + t->t_defattr.ta_format &= ~TF_BOLD; + t->t_curattr.ta_format &= ~TF_BOLD; + } +} + static void teken_subr_cons25_switch_virtual_terminal(teken_t *t, unsigned int vt) {