summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2012-05-06 13:23:55 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2012-05-06 13:23:55 +0000
commit7254022c88a8b4d6bb16ac26eb01b1b6ae69c551 (patch)
tree0a0715b62bc6142bfd072cc1ed05afe58e03924f /sys
parent681c38ee71d754053cfe496e1868dd219b77502b (diff)
add support for the reverse video attribute in sti(4)
makes programs like less and mg look a wee bit prettier ok miod
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/sti.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
index ae7957bf7e8..7dc93747c11 100644
--- a/sys/dev/ic/sti.c
+++ b/sys/dev/ic/sti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti.c,v 1.64 2011/09/19 11:15:18 miod Exp $ */
+/* $OpenBSD: sti.c,v 1.65 2012/05/06 13:23:54 mikeb Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -618,7 +618,7 @@ sti_screen_setup(struct sti_screen *scr, int flags)
scr->scr_wsd.textops = &sti_emulops;
scr->scr_wsd.fontwidth = scr->scr_curfont.width;
scr->scr_wsd.fontheight = scr->scr_curfont.height;
- scr->scr_wsd.capabilities = 0;
+ scr->scr_wsd.capabilities = WSSCREEN_REVERSE;
scr->scr_scrlist[0] = &scr->scr_wsd;
scr->scr_screenlist.nscreens = 1;
@@ -1195,6 +1195,9 @@ sti_putchar(void *v, int row, int col, u_int uc, long attr)
struct sti_screen *scr = (struct sti_screen *)v;
struct sti_rom *rom = scr->scr_rom;
struct sti_font *fp = &scr->scr_curfont;
+ int bg, fg;
+
+ sti_unpack_attr(scr, attr, &fg, &bg, NULL);
if (scr->scr_romfont != NULL) {
/*
@@ -1209,9 +1212,9 @@ sti_putchar(void *v, int row, int col, u_int uc, long attr)
bzero(&a, sizeof(a));
a.flags.flags = STI_UNPMVF_WAIT;
- /* XXX does not handle text attributes */
- a.in.fg_colour = STI_COLOUR_WHITE;
- a.in.bg_colour = STI_COLOUR_BLACK;
+ a.in.fg_colour = fg;
+ a.in.bg_colour = bg;
+
a.in.x = col * fp->width;
a.in.y = row * fp->height;
a.in.font_addr = scr->scr_romfont;
@@ -1231,9 +1234,8 @@ sti_putchar(void *v, int row, int col, u_int uc, long attr)
bzero(&a, sizeof(a));
a.flags.flags = STI_BLKMVF_WAIT;
- /* XXX does not handle text attributes */
- a.in.fg_colour = STI_COLOUR_WHITE;
- a.in.bg_colour = STI_COLOUR_BLACK;
+ a.in.fg_colour = fg;
+ a.in.bg_colour = bg;
a.in.srcx = ((uc - fp->first) / scr->scr_fontmaxcol) *
fp->width + scr->scr_fontbase;
@@ -1309,7 +1311,7 @@ sti_alloc_attr(void *v, int fg, int bg, int flags, long *pattr)
struct sti_screen *scr = (struct sti_screen *)v;
#endif
- *pattr = 0;
+ *pattr = flags & WSATTR_REVERSE;
return 0;
}
@@ -1320,8 +1322,13 @@ sti_unpack_attr(void *v, long attr, int *fg, int *bg, int *ul)
struct sti_screen *scr = (struct sti_screen *)v;
#endif
- *fg = WSCOL_WHITE;
- *bg = WSCOL_BLACK;
+ if (attr & WSATTR_REVERSE) {
+ *fg = STI_COLOUR_BLACK;
+ *bg = STI_COLOUR_WHITE;
+ } else {
+ *fg = STI_COLOUR_WHITE;
+ *bg = STI_COLOUR_BLACK;
+ }
if (ul != NULL)
*ul = 0;
}