diff options
author | ed <ed@FreeBSD.org> | 2009-09-03 16:31:11 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-09-03 16:31:11 +0000 |
commit | d8165e001962c64b9b665cb5bc9e20184cdb5fa0 (patch) | |
tree | a9087c764d89b371208982c932f94c66e4e73f2f /sys/dev/syscons | |
parent | dab6d9f06b219684a564ae73f7601422d5135ebd (diff) | |
download | FreeBSD-src-d8165e001962c64b9b665cb5bc9e20184cdb5fa0.zip FreeBSD-src-d8165e001962c64b9b665cb5bc9e20184cdb5fa0.tar.gz |
Expose the TF_REVERSE flag to the console driver.
Right now libteken processes TF_REVERSE internally and returns the
toggled colors to the console driver. This isn't entirely correct. This
means that the bold flag is always processed by the foreground color,
while reversing should be done after the foreground color has been set
to a brighter version by the bold flag.
This is no problem with the syscons driver, because with VGA it only
supports 16 foreground and 8 background colors. My WIP console driver
reconfigures the graphics hardware to disable the blink functionality
and uses 16 foreground and 16 background colors. This means that this
driver will handle the TF_REVERSE flag a little different from what
syscons does right now.
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/scterm-teken.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/syscons/scterm-teken.c b/sys/dev/syscons/scterm-teken.c index 6f51ac1..133d622 100644 --- a/sys/dev/syscons/scterm-teken.c +++ b/sys/dev/syscons/scterm-teken.c @@ -300,12 +300,20 @@ static unsigned int scteken_attr(const teken_attr_t *a) { unsigned int attr = 0; + teken_color_t fg, bg; + if (a->ta_format & TF_REVERSE) { + fg = a->ta_bgcolor; + bg = a->ta_fgcolor; + } else { + fg = a->ta_fgcolor; + bg = a->ta_bgcolor; + } if (a->ta_format & TF_BOLD) - attr |= fgcolors_bold[a->ta_fgcolor]; + attr |= fgcolors_bold[fg]; else - attr |= fgcolors_normal[a->ta_fgcolor]; - attr |= bgcolors[a->ta_bgcolor]; + attr |= fgcolors_normal[fg]; + attr |= bgcolors[bg]; #ifdef FG_UNDERLINE if (a->ta_format & TF_UNDERLINE) |