mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
console: purge curses bits from console.h
Handle the translation from vga chars to curses chars in curses_update() instead of console_write_ch(). Purge any curses support bits from ui/console.h include file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170927103811.19249-1-kraxel@redhat.com
This commit is contained in:
parent
ab16152926
commit
e2f82e924d
3 changed files with 28 additions and 26 deletions
25
ui/curses.c
25
ui/curses.c
|
@ -33,6 +33,11 @@
|
|||
#include "ui/input.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
/* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */
|
||||
#undef KEY_EVENT
|
||||
#include <curses.h>
|
||||
#undef KEY_EVENT
|
||||
|
||||
#define FONT_HEIGHT 16
|
||||
#define FONT_WIDTH 8
|
||||
|
||||
|
@ -42,16 +47,26 @@ static WINDOW *screenpad = NULL;
|
|||
static int width, height, gwidth, gheight, invalidate;
|
||||
static int px, py, sminx, sminy, smaxx, smaxy;
|
||||
|
||||
chtype vga_to_curses[256];
|
||||
static chtype vga_to_curses[256];
|
||||
|
||||
static void curses_update(DisplayChangeListener *dcl,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
chtype *line;
|
||||
console_ch_t *line;
|
||||
chtype curses_line[width];
|
||||
|
||||
line = ((chtype *) screen) + y * width;
|
||||
for (h += y; y < h; y ++, line += width)
|
||||
mvwaddchnstr(screenpad, y, 0, line, width);
|
||||
line = screen + y * width;
|
||||
for (h += y; y < h; y ++, line += width) {
|
||||
for (x = 0; x < width; x++) {
|
||||
chtype ch = line[x] & 0xff;
|
||||
chtype at = line[x] & ~0xff;
|
||||
if (vga_to_curses[ch]) {
|
||||
ch = vga_to_curses[ch];
|
||||
}
|
||||
curses_line[x] = ch | at;
|
||||
}
|
||||
mvwaddchnstr(screenpad, y, 0, curses_line, width);
|
||||
}
|
||||
|
||||
pnoutrefresh(screenpad, py, px, sminy, sminx, smaxy - 1, smaxx - 1);
|
||||
refresh();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue