Change the way the default foreground and background colors are chosen:

require the front-end to initialize rc_deffgcolor and rc_defbgcolor (both
new members), and override these only if RASTERCONSOLE_{FG,BG}COL are
set in the kernel configuration file.
This commit is contained in:
thorpej 1999-08-26 20:48:09 +00:00
parent 8679b79192
commit f0629e4b90
2 changed files with 18 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcons.h,v 1.8 1999/05/23 17:59:39 ad Exp $ */
/* $NetBSD: rcons.h,v 1.9 1999/08/26 20:48:09 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -46,14 +46,7 @@
#ifndef _RCONS_H_
#define _RCONS_H_ 1
/* Default color values */
#include "opt_rcons.h"
#ifndef RASTERCONSOLE_FGCOL
#define RASTERCONSOLE_FGCOL WSCOL_WHITE
#endif
#ifndef RASTERCONSOLE_BGCOL
#define RASTERCONSOLE_BGCOL WSCOL_BLACK
#endif
/* Avoid dragging in dev/wscons/wsdisplayvar.h */
struct wsdisplay_emulops;
@ -70,6 +63,10 @@ struct rconsole {
u_int rc_row; /* emulator row */
u_int rc_col; /* emulator column */
/* These may be overridden in the kernel config file. */
int rc_deffgcolor; /* default fg color */
int rc_defbgcolor; /* default bg color */
/* Bits maintained by the raster routines */
u_int rc_bits; /* see defines below */
int rc_ringing; /* bell currently ringing */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rcons_subr.c,v 1.5 1999/05/19 20:07:34 ad Exp $ */
/* $NetBSD: rcons_subr.c,v 1.6 1999/08/26 20:48:09 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -79,8 +79,14 @@ rcons_init_ops(rc)
rc->rc_ops->mapchar(rc->rc_cookie, i, rc->rc_charmap + i);
/* Determine which attributes the device supports. */
rc->rc_fgcolor = RASTERCONSOLE_FGCOL;
rc->rc_bgcolor = RASTERCONSOLE_BGCOL;
#ifdef RASTERCONSOLE_FGCOL
rc->rc_deffgcolor = RASTERCONSOLE_FGCOL;
#endif
#ifdef RASTERCONSOLE_BGCOL
rc->rc_defbgcolor = RASTERCONSOLE_BGCOL;
#endif
rc->rc_fgcolor = rc->rc_deffgcolor;
rc->rc_bgcolor = rc->rc_defbgcolor;
rc->rc_supwsflg = 0;
for (i = 1; i < 256; i <<= 1)
@ -89,11 +95,11 @@ rcons_init_ops(rc)
/* Allocate kernel output attribute */
rc->rc_wsflg = WSATTR_HILIT;
rcons_setcolor(rc, RASTERCONSOLE_FGCOL, RASTERCONSOLE_BGCOL);
rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
rc->rc_kern_attr = rc->rc_attr;
rc->rc_wsflg = 0;
rcons_setcolor(rc, RASTERCONSOLE_FGCOL, RASTERCONSOLE_BGCOL);
rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
}
/* Output (or at least handle) a string sent to the console */
@ -271,7 +277,7 @@ rcons_sgresc(rc, c)
/* Clear all attributes || End underline */
case 0:
rc->rc_wsflg = 0;
rcons_setcolor(rc, RASTERCONSOLE_FGCOL, RASTERCONSOLE_BGCOL);
rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
break;
/* ANSI foreground color */
@ -444,7 +450,7 @@ rcons_doesc(rc, c)
rc->rc_wsflg = 0;
rc->rc_scroll = 0;
rc->rc_bits &= ~FB_NO_CURSOR;
rcons_setcolor(rc, RASTERCONSOLE_FGCOL, RASTERCONSOLE_BGCOL);
rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
if (rc->rc_bits & FB_INVERT)
rcons_invert(rc, 0);