From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrTMu-0005UJ-6Y for qemu-devel@nongnu.org; Mon, 02 Jun 2014 10:37:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrTMm-0000ZM-C4 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 10:37:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrTMm-0000Z5-2z for qemu-devel@nongnu.org; Mon, 02 Jun 2014 10:37:36 -0400 From: Gerd Hoffmann Date: Mon, 2 Jun 2014 16:37:27 +0200 Message-Id: <1401719850-16998-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1401719850-16998-1-git-send-email-kraxel@redhat.com> References: <1401719850-16998-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/4] console: add kbd_put_qcode_console List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 1 + ui/console.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index b513e20..4ad16c9 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 75ec3af..b99312c 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); -- 1.8.3.1