From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 1/4] console: add kbd_put_qcode_console
Date: Mon, 2 Jun 2014 16:37:27 +0200 [thread overview]
Message-ID: <1401719850-16998-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1401719850-16998-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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
next prev parent reply other threads:[~2014-06-02 14:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 14:37 [Qemu-devel] [PULL 0/4] sdl2: add support for text consoles Gerd Hoffmann
2014-06-02 14:37 ` Gerd Hoffmann [this message]
2014-06-02 14:37 ` [Qemu-devel] [PULL 2/4] console: add kbd_put_string_console Gerd Hoffmann
2014-06-02 14:37 ` [Qemu-devel] [PULL 3/4] sdl2: make Ctrl-Alt-<nr> hotkeys show and hide windows Gerd Hoffmann
2014-06-02 14:37 ` [Qemu-devel] [PULL 4/4] sdl2: textinput + terminal Gerd Hoffmann
2014-06-02 16:06 ` [Qemu-devel] [PULL 0/4] sdl2: add support for text consoles Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401719850-16998-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@amazon.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).