From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH RESEND 1/1] vnc: improve numpad support for qemu console.
Date: Thu, 11 Jun 2009 11:32:14 +0200 [thread overview]
Message-ID: <1244712734-14345-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1244712734-14345-1-git-send-email-kraxel@redhat.com>
Reorganize qemu console emulation code. Make it look at the numlock
state and interpret numpad keys as arrow+friends (numlock off) or
digits (numlock on). While being at it also wind up the other numpad
keys.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
vnc.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/vnc.c b/vnc.c
index dbbeb14..22dc96d 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1333,6 +1333,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
} else {
/* QEMU console emulation */
if (down) {
+ int numlock = vs->modifiers_state[0x45];
switch (keycode) {
case 0x2a: /* Left Shift */
case 0x36: /* Right Shift */
@@ -1342,41 +1343,83 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
case 0xb8: /* Right ALT */
break;
case 0xc8:
- case 0x48:
kbd_put_keysym(QEMU_KEY_UP);
break;
case 0xd0:
- case 0x50:
kbd_put_keysym(QEMU_KEY_DOWN);
break;
case 0xcb:
- case 0x4b:
kbd_put_keysym(QEMU_KEY_LEFT);
break;
case 0xcd:
- case 0x4d:
kbd_put_keysym(QEMU_KEY_RIGHT);
break;
case 0xd3:
- case 0x53:
kbd_put_keysym(QEMU_KEY_DELETE);
break;
case 0xc7:
- case 0x47:
kbd_put_keysym(QEMU_KEY_HOME);
break;
case 0xcf:
- case 0x4f:
kbd_put_keysym(QEMU_KEY_END);
break;
case 0xc9:
- case 0x49:
kbd_put_keysym(QEMU_KEY_PAGEUP);
break;
case 0xd1:
- case 0x51:
kbd_put_keysym(QEMU_KEY_PAGEDOWN);
break;
+
+ case 0x47:
+ kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME);
+ break;
+ case 0x48:
+ kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP);
+ break;
+ case 0x49:
+ kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP);
+ break;
+ case 0x4b:
+ kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT);
+ break;
+ case 0x4c:
+ kbd_put_keysym('5');
+ break;
+ case 0x4d:
+ kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT);
+ break;
+ case 0x4f:
+ kbd_put_keysym(numlock ? '1' : QEMU_KEY_END);
+ break;
+ case 0x50:
+ kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN);
+ break;
+ case 0x51:
+ kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN);
+ break;
+ case 0x52:
+ kbd_put_keysym('0');
+ break;
+ case 0x53:
+ kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE);
+ break;
+
+ case 0xb5:
+ kbd_put_keysym('/');
+ break;
+ case 0x37:
+ kbd_put_keysym('*');
+ break;
+ case 0x4a:
+ kbd_put_keysym('-');
+ break;
+ case 0x4e:
+ kbd_put_keysym('+');
+ break;
+ case 0x9c:
+ kbd_put_keysym('\n');
+ break;
+
default:
kbd_put_keysym(sym);
break;
--
1.6.2.2
prev parent reply other threads:[~2009-06-11 9:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-11 9:32 [Qemu-devel] [PATCH RESEND 0/1] vnc update Gerd Hoffmann
2009-06-11 9:32 ` Gerd Hoffmann [this message]
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=1244712734-14345-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.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).