diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-07-25 19:03:26 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-07-25 19:03:26 +0000 |
commit | 48bbde10e0385b5b1c97150234d637538444f51b (patch) | |
tree | 184767c4451f5e6d0cd0930b704ab371c059b844 /sys | |
parent | c7866a5b25f02593194ade0e26348772eb9dd911 (diff) |
Rework the color usage in wsemul_sun displays, to match SunOS and Solaris
text mode colors.
This means black text on white background, even for the kernel messages.
Initially based on a patch from jason@, then some tinkering by me.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/wscons/wsdisplayvar.h | 16 | ||||
-rw-r--r-- | sys/dev/wscons/wsemul_sun.c | 22 |
2 files changed, 30 insertions, 8 deletions
diff --git a/sys/dev/wscons/wsdisplayvar.h b/sys/dev/wscons/wsdisplayvar.h index 867a5e90349..3b13326aa62 100644 --- a/sys/dev/wscons/wsdisplayvar.h +++ b/sys/dev/wscons/wsdisplayvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsdisplayvar.h,v 1.13 2002/03/27 18:54:09 jbm Exp $ */ +/* $OpenBSD: wsdisplayvar.h,v 1.14 2002/07/25 19:03:25 miod Exp $ */ /* $NetBSD: wsdisplayvar.h,v 1.14.4.1 2000/06/30 16:27:53 simonb Exp $ */ /* @@ -66,14 +66,20 @@ struct wsdisplay_emulops { void (*eraserows)(void *c, int row, int nrows, long); int (*alloc_attr)(void *c, int fg, int bg, int flags, long *); /* fg / bg values. Made identical to ANSI terminal color codes. */ +/* XXX should be #if NWSEMUL_SUN > 1 */ +#if defined(__sparc__) || defined(__sparc64__) +#define WSCOL_WHITE wscol_white +#define WSCOL_BLACK wscol_black +#else #define WSCOL_BLACK 0 +#define WSCOL_WHITE 7 +#endif #define WSCOL_RED 1 #define WSCOL_GREEN 2 #define WSCOL_BROWN 3 #define WSCOL_BLUE 4 #define WSCOL_MAGENTA 5 #define WSCOL_CYAN 6 -#define WSCOL_WHITE 7 /* flag values: */ #define WSATTR_REVERSE 1 #define WSATTR_HILIT 2 @@ -83,6 +89,12 @@ struct wsdisplay_emulops { /* XXX need a free_attr() ??? */ }; +/* XXX should be #if NWSEMUL_SUN > 1 */ +#if defined(__sparc__) || defined(__sparc64__) +extern int wscol_white, wscol_black; +extern int wskernel_fg, wskernel_bg; +#endif + #define WSSCREEN_NAME_SIZE 16 struct wsscreen_descr { diff --git a/sys/dev/wscons/wsemul_sun.c b/sys/dev/wscons/wsemul_sun.c index bc7fcf54632..da531ebf086 100644 --- a/sys/dev/wscons/wsemul_sun.c +++ b/sys/dev/wscons/wsemul_sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsemul_sun.c,v 1.5 2002/05/30 18:25:44 fgsch Exp $ */ +/* $OpenBSD: wsemul_sun.c,v 1.6 2002/07/25 19:03:25 miod Exp $ */ /* $NetBSD: wsemul_sun.c,v 1.11 2000/01/05 11:19:36 drochner Exp $ */ /* @@ -109,6 +109,16 @@ struct wsemul_sun_emuldata wsemul_sun_console_emuldata; #define COLS_LEFT (edp->ncols - edp->ccol - 1) #define ROWS_LEFT (edp->nrows - edp->crow - 1) +/* + * wscons color codes + * To compensate for Sun color choices on older framebuffers, these need to + * be variables. + */ +int wscol_white = 0; /* 0 */ +int wscol_black = 7; /* 255 */ +int wskernel_bg = 7; /* 0 */ +int wskernel_fg = 0; /* 255 */ + void * wsemul_sun_cnattach(type, cookie, ccol, crow, defattr) const struct wsscreen_descr *type; @@ -131,10 +141,10 @@ wsemul_sun_cnattach(type, cookie, ccol, crow, defattr) edp->curattr = edp->defattr = defattr; #ifndef WS_KERNEL_FG -#define WS_KERNEL_FG WSCOL_WHITE +#define WS_KERNEL_FG wskernel_bg #endif #ifndef WS_KERNEL_BG -#define WS_KERNEL_BG WSCOL_BLACK +#define WS_KERNEL_BG wskernel_fg #endif #ifndef WS_KERNEL_COLATTR #define WS_KERNEL_COLATTR 0 @@ -204,7 +214,7 @@ wsemul_sun_attach(console, type, cookie, ccol, crow, cbcookie, defattr) /* XXX This assumes that the default attribute is wob. */ if ((!(edp->scrcapabilities & WSSCREEN_WSCOLORS) || (*edp->emulops->alloc_attr)(edp->emulcookie, - WSCOL_BLACK, WSCOL_WHITE, + WSCOL_WHITE, WSCOL_BLACK, WSATTR_WSCOLORS, &edp->bowattr)) && (!(edp->scrcapabilities & WSSCREEN_REVERSE) || @@ -362,7 +372,7 @@ wsemul_sun_control(edp, c) src, dst, edp->ncols - dst); } (*edp->emulops->erasecols)(edp->emulcookie, edp->crow, - src, dst - src, edp->curattr); + src, n, edp->curattr); break; case 'A': /* "Cursor Up (CUU)" */ @@ -434,7 +444,7 @@ wsemul_sun_control(edp, c) src, dst, edp->ncols - src); } (*edp->emulops->erasecols)(edp->emulcookie, edp->crow, - dst + edp->ncols - src, src - dst, edp->curattr); + edp->ncols - n, n, edp->curattr); break; case 'm': /* "Select Graphic Rendition (SGR)" */ |