提交 50ef4679 编写于 作者: G Gerd Hoffmann

console: add kbd_put_qcode_console

Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 9bb93180
...@@ -82,6 +82,7 @@ void do_mouse_set(Monitor *mon, const QDict *qdict); ...@@ -82,6 +82,7 @@ void do_mouse_set(Monitor *mon, const QDict *qdict);
#define QEMU_KEY_CTRL_PAGEDOWN 0xe407 #define QEMU_KEY_CTRL_PAGEDOWN 0xe407
void kbd_put_keysym_console(QemuConsole *s, int keysym); void kbd_put_keysym_console(QemuConsole *s, int keysym);
bool kbd_put_qcode_console(QemuConsole *s, int qcode);
void kbd_put_keysym(int keysym); void kbd_put_keysym(int keysym);
/* consoles */ /* consoles */
......
...@@ -1109,6 +1109,30 @@ void kbd_put_keysym_console(QemuConsole *s, int keysym) ...@@ -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) void kbd_put_keysym(int keysym)
{ {
kbd_put_keysym_console(active_console, keysym); kbd_put_keysym_console(active_console, keysym);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册