From owner-svn-src-head@FreeBSD.ORG Sat Jan 17 23:01:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6881410656F0; Sat, 17 Jan 2009 23:01:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56E368FC27; Sat, 17 Jan 2009 23:01:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0HN1eSJ054708; Sat, 17 Jan 2009 23:01:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0HN1ePm054707; Sat, 17 Jan 2009 23:01:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901172301.n0HN1ePm054707@svn.freebsd.org> From: Ed Schouten Date: Sat, 17 Jan 2009 23:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187374 - head/sys/dev/syscons/teken X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2009 23:01:41 -0000 Author: ed Date: Sat Jan 17 23:01:40 2009 New Revision: 187374 URL: http://svn.freebsd.org/changeset/base/187374 Log: Fix for my previous commit: color mapping is not 1:1. Cons25 doesn't seem to use a straight 1:1 mapping to the ANSI colors, but uses the same color numbers as at least used by syscons on i386. I suspect if you change the definitions on a different architecture, things may break? Not sure. Add a small array to convert syscons-style color codes to ANSI equivalents, which are used by libteken internally. I didn't notice this bug, because I only tested my code with black, white and green, all of them shared the same numbers. Modified: head/sys/dev/syscons/teken/teken_subr_compat.h Modified: head/sys/dev/syscons/teken/teken_subr_compat.h ============================================================================== --- head/sys/dev/syscons/teken/teken_subr_compat.h Sat Jan 17 22:53:53 2009 (r187373) +++ head/sys/dev/syscons/teken/teken_subr_compat.h Sat Jan 17 23:01:40 2009 (r187374) @@ -33,20 +33,23 @@ teken_subr_cons25_set_cursor_type(teken_ teken_funcs_param(t, TP_SHOWCURSOR, type != 1); } +static teken_color_t cons25_colors[8] = { TC_BLACK, TC_BLUE, TC_GREEN, + TC_CYAN, TC_RED, TC_MAGENTA, TC_BROWN, TC_WHITE }; + 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; + t->t_defattr.ta_bgcolor = cons25_colors[c % 8]; + t->t_curattr.ta_bgcolor = cons25_colors[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; + t->t_defattr.ta_fgcolor = cons25_colors[c % 8]; + t->t_curattr.ta_fgcolor = cons25_colors[c % 8]; if (c >= 8) { t->t_defattr.ta_format |= TF_BOLD; t->t_curattr.ta_format |= TF_BOLD;