Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/rcons Change the way the default foreground and back...



details:   https://anonhg.NetBSD.org/src/rev/dd806ca7be83
branches:  trunk
changeset: 475822:dd806ca7be83
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Aug 26 20:48:09 1999 +0000

description:
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.

diffstat:

 sys/dev/rcons/rcons.h      |  13 +++++--------
 sys/dev/rcons/rcons_subr.c |  20 +++++++++++++-------
 2 files changed, 18 insertions(+), 15 deletions(-)

diffs (93 lines):

diff -r db1a6312a914 -r dd806ca7be83 sys/dev/rcons/rcons.h
--- a/sys/dev/rcons/rcons.h     Thu Aug 26 20:44:50 1999 +0000
+++ b/sys/dev/rcons/rcons.h     Thu Aug 26 20:48:09 1999 +0000
@@ -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 @@
        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 */
diff -r db1a6312a914 -r dd806ca7be83 sys/dev/rcons/rcons_subr.c
--- a/sys/dev/rcons/rcons_subr.c        Thu Aug 26 20:44:50 1999 +0000
+++ b/sys/dev/rcons/rcons_subr.c        Thu Aug 26 20:48:09 1999 +0000
@@ -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 @@
                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 @@
 
        /* 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 @@
        /* 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 @@
                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);



Home | Main Index | Thread Index | Old Index