aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-05-27 09:28:38 +0200
committerGerd Hoffmann <kraxel@redhat.com>2014-06-02 16:28:58 +0200
commit50ef4679232369b531d5265ebe92550f98a75ea6 (patch)
tree839a23685b46fdac53f64b32be6fdf36facfc871
parent9bb931802e6ab5ab6947e3cb9cea934fc0724274 (diff)
console: add kbd_put_qcode_console
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--include/ui/console.h1
-rw-r--r--ui/console.c24
2 files changed, 25 insertions, 0 deletions
diff --git a/include/ui/console.h b/include/ui/console.h
index b513e2082d..4ad16c9e14 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -82,6 +82,7 @@ void do_mouse_set(Monitor *mon, const QDict *qdict);
#define QEMU_KEY_CTRL_PAGEDOWN 0xe407
void kbd_put_keysym_console(QemuConsole *s, int keysym);
+bool kbd_put_qcode_console(QemuConsole *s, int qcode);
void kbd_put_keysym(int keysym);
/* consoles */
diff --git a/ui/console.c b/ui/console.c
index 75ec3afcf7..b99312c014 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1109,6 +1109,30 @@ void kbd_put_keysym_console(QemuConsole *s, int keysym)
}
}
+static const int qcode_to_keysym[Q_KEY_CODE_MAX] = {
+ [Q_KEY_CODE_UP] = QEMU_KEY_UP,
+ [Q_KEY_CODE_DOWN] = QEMU_KEY_DOWN,
+ [Q_KEY_CODE_RIGHT] = QEMU_KEY_RIGHT,
+ [Q_KEY_CODE_LEFT] = QEMU_KEY_LEFT,
+ [Q_KEY_CODE_HOME] = QEMU_KEY_HOME,
+ [Q_KEY_CODE_END] = QEMU_KEY_END,
+ [Q_KEY_CODE_PGUP] = QEMU_KEY_PAGEUP,
+ [Q_KEY_CODE_PGDN] = QEMU_KEY_PAGEDOWN,
+ [Q_KEY_CODE_DELETE] = QEMU_KEY_DELETE,
+};
+
+bool kbd_put_qcode_console(QemuConsole *s, int qcode)
+{
+ int keysym;
+
+ keysym = qcode_to_keysym[qcode];
+ if (keysym == 0) {
+ return false;
+ }
+ kbd_put_keysym_console(s, keysym);
+ return true;
+}
+
void kbd_put_keysym(int keysym)
{
kbd_put_keysym_console(active_console, keysym);