diff options
author | OGAWA Hirofumi | 2015-11-29 14:28:24 +0100 |
---|---|---|
committer | Gerd Hoffmann | 2016-01-08 12:20:07 +0100 |
commit | 4083733db5e4120939acee57019ff52db1f45b9d (patch) | |
tree | 8f268767181decdd790235ae5aa30d773eb4e891 /hw/display/vga.c | |
parent | petalogix-ml605: Set the MicroBlaze CPU version to 8.10.a (diff) | |
download | qemu-4083733db5e4120939acee57019ff52db1f45b9d.tar.gz qemu-4083733db5e4120939acee57019ff52db1f45b9d.tar.xz qemu-4083733db5e4120939acee57019ff52db1f45b9d.zip |
ui/curses: Fix color attribute of monitor for curses
Current text_console_update() writes totally broken color attributes
to console_write_ch(). The format now is writing,
[WRONG]
bold << 21 | fg << 12 | bg << 8 | char
fg == 3bits curses color number
bg == 3bits curses color number
I can't see this format is where come from. Anyway, this doesn't work
at all.
What curses expects is actually (and vga.c is using),
[RIGHT]
bold << 21 | bg << 11 | fg << 8 | char
fg == 3bits vga color number
bg == 3bits vga color number
And curses set COLOR_PAIR() up to match this format, and curses's
chtype. I.e,
bold | color_pair | char
color_pair == (bg << 3 | fg)
To fix, this simply uses VGA color number everywhere except curses.c
internal. Then, convert it to above [RIGHT] format to write by
console_write_ch(). And as bonus, this reduces to expose curses define
to other parts (removes COLOR_* from console.c).
[Tested the first line is displayed as white on blue back for monitor
in curses console]
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Message-id: 87r3j95407.fsf@mail.parknet.co.jp
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/vga.c')
-rw-r--r-- | hw/display/vga.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c index 9f6839488b..84ce0af562 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1979,7 +1979,8 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) width = (s->last_width - size) / 2; dst = chardata + s->last_width + width; for (i = 0; i < size; i ++) - console_write_ch(dst ++, 0x00200100 | msg_buffer[i]); + console_write_ch(dst ++, ATTR2CHTYPE(msg_buffer[i], QEMU_COLOR_BLUE, + QEMU_COLOR_BLACK, 1)); dpy_text_update(s->con, 0, 0, s->last_width, height); } |