mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
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>
This commit is contained in:
parent
a7e00e2536
commit
4083733db5
5 changed files with 76 additions and 62 deletions
|
@ -30,6 +30,21 @@
|
|||
#define GUI_REFRESH_INTERVAL_DEFAULT 30
|
||||
#define GUI_REFRESH_INTERVAL_IDLE 3000
|
||||
|
||||
/* Color number is match to standard vga palette */
|
||||
enum qemu_color_names {
|
||||
QEMU_COLOR_BLACK = 0,
|
||||
QEMU_COLOR_BLUE = 1,
|
||||
QEMU_COLOR_GREEN = 2,
|
||||
QEMU_COLOR_CYAN = 3,
|
||||
QEMU_COLOR_RED = 4,
|
||||
QEMU_COLOR_MAGENTA = 5,
|
||||
QEMU_COLOR_YELLOW = 6,
|
||||
QEMU_COLOR_WHITE = 7
|
||||
};
|
||||
/* Convert to curses char attributes */
|
||||
#define ATTR2CHTYPE(c, fg, bg, bold) \
|
||||
((bold) << 21 | (bg) << 11 | (fg) << 8 | (c))
|
||||
|
||||
typedef void QEMUPutKBDEvent(void *opaque, int keycode);
|
||||
typedef void QEMUPutLEDEvent(void *opaque, int ledstate);
|
||||
typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue