summaryrefslogtreecommitdiffstats
path: root/ui/curses.c
diff options
context:
space:
mode:
authorPeter Maydell2017-10-03 14:50:10 +0200
committerPeter Maydell2017-10-03 14:50:10 +0200
commit2c94822167672597d870dbeed9ffc95ea2bf93d3 (patch)
tree64360f9d04fe2c6ddec5fffb6272d6f811490d45 /ui/curses.c
parentMerge remote-tracking branch 'remotes/famz/tags/docker-testing-pull-request' ... (diff)
parentui: add tracing of VNC authentication process (diff)
downloadqemu-2c94822167672597d870dbeed9ffc95ea2bf93d3.tar.gz
qemu-2c94822167672597d870dbeed9ffc95ea2bf93d3.tar.xz
qemu-2c94822167672597d870dbeed9ffc95ea2bf93d3.zip
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20170929-pull-request' into staging
ui and input patches. # gpg: Signature made Fri 29 Sep 2017 11:21:45 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20170929-pull-request: ui: add tracing of VNC authentication process ui: add tracing of VNC operations related to QIOChannel virtio-input: send rel-wheel events for wheel buttons egl: misc framebuffer helper improvements. console: purge curses bits from console.h Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/curses.c')
-rw-r--r--ui/curses.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/ui/curses.c b/ui/curses.c
index 03cefdf470..85503876c0 100644
--- a/ui/curses.c
+++ b/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;
-
- line = ((chtype *) screen) + y * width;
- for (h += y; y < h; y ++, line += width)
- mvwaddchnstr(screenpad, y, 0, line, width);
+ console_ch_t *line;
+ chtype curses_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();