Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rcons Use a default attribute to restore the display...



details:   https://anonhg.NetBSD.org/src/rev/28ae13d85a0f
branches:  trunk
changeset: 485017:28ae13d85a0f
user:      pk <pk%NetBSD.org@localhost>
date:      Sun Apr 16 21:49:49 2000 +0000

description:
Use a default attribute to restore the display mode to original settings.
Also, pass in WSATTR_COLORS at all times when allocating screen attributes
since without it we cannot even get black-on-white from rasops(9).

diffstat:

 sys/dev/rcons/rcons.h      |   5 +++--
 sys/dev/rcons/rcons_subr.c |  26 +++++++++++++++++++-------
 2 files changed, 22 insertions(+), 9 deletions(-)

diffs (93 lines):

diff -r 9aa9102dadcb -r 28ae13d85a0f sys/dev/rcons/rcons.h
--- a/sys/dev/rcons/rcons.h     Sun Apr 16 21:41:49 2000 +0000
+++ b/sys/dev/rcons/rcons.h     Sun Apr 16 21:49:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcons.h,v 1.11 2000/03/23 07:01:42 thorpej Exp $ */
+/*     $NetBSD: rcons.h,v 1.12 2000/04/16 21:49:49 pk Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -80,7 +80,8 @@
        int     rc_p1;                  /* escape sequence parameter 1 */
        int     rc_fgcolor;             /* current fg color */
        int     rc_bgcolor;             /* current bg color */
-       long    rc_attr;                /* wscons text attribute */
+       long    rc_attr;                /* current wscons text attribute */
+       long    rc_defattr;             /* default text attribute */
        long    rc_kern_attr;           /* kernel output attribute */
        u_int   rc_wsflg;               /* wscons attribute flags */
        u_int   rc_supwsflg;            /* supported attribute flags */
diff -r 9aa9102dadcb -r 28ae13d85a0f sys/dev/rcons/rcons_subr.c
--- a/sys/dev/rcons/rcons_subr.c        Sun Apr 16 21:41:49 2000 +0000
+++ b/sys/dev/rcons/rcons_subr.c        Sun Apr 16 21:49:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcons_subr.c,v 1.6 1999/08/26 20:48:09 thorpej Exp $ */
+/*     $NetBSD: rcons_subr.c,v 1.7 2000/04/16 21:49:49 pk Exp $ */
 
 /*
  * Copyright (c) 1991, 1993
@@ -100,6 +100,7 @@
        
        rc->rc_wsflg = 0;
        rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
+       rc->rc_defattr = rc->rc_attr;
 }
 
 /* Output (or at least handle) a string sent to the console */
@@ -277,7 +278,9 @@
        /* Clear all attributes || End underline */
        case 0:
                rc->rc_wsflg = 0;
-               rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
+               rc->rc_fgcolor = rc->rc_deffgcolor;
+               rc->rc_bgcolor = rc->rc_defbgcolor;
+               rc->rc_attr = rc->rc_defattr;
                break;
 
        /* ANSI foreground color */
@@ -426,14 +429,18 @@
 
                break;
 
+       /*
+        * XXX: setting SUNBOW and SUNWOB should probably affect
+        * deffgcolor, defbgcolor and defattr too.
+        */
        case 'p':
                /* Black On White (SUNBOW) */
-               rcons_invert(rc, 0);
+               rcons_setcolor(rc, WSCOL_BLACK, WSCOL_WHITE);
                break;
 
        case 'q':
                /* White On Black (SUNWOB) */
-               rcons_invert(rc, 1);
+               rcons_setcolor(rc, WSCOL_WHITE, WSCOL_BLACK);
                break;
 
        case 'r':
@@ -450,7 +457,9 @@
                rc->rc_wsflg = 0;
                rc->rc_scroll = 0;
                rc->rc_bits &= ~FB_NO_CURSOR;
-               rcons_setcolor(rc, rc->rc_deffgcolor, rc->rc_defbgcolor);
+               rc->rc_fgcolor = rc->rc_deffgcolor;
+               rc->rc_bgcolor = rc->rc_defbgcolor;
+               rc->rc_attr = rc->rc_defattr;
 
                if (rc->rc_bits & FB_INVERT)
                        rcons_invert(rc, 0);
@@ -513,8 +522,11 @@
                fg = flg;
        }
        
-       /* Mask out unsupported flags and get attribute */
-       flg = rc->rc_wsflg & rc->rc_supwsflg;
+       /*
+        * Mask out unsupported flags and get attribute
+        * XXX - always ask for WSCOLORS if supported (why shouldn't we?)
+        */
+       flg = (rc->rc_wsflg | WSATTR_WSCOLORS) & rc->rc_supwsflg;
        rc->rc_bgcolor = bg;
        rc->rc_fgcolor = fg;
        rc->rc_ops->alloc_attr(rc->rc_cookie, fg, bg, flg, &rc->rc_attr);



Home | Main Index | Thread Index | Old Index