From: Amos Kong <akong@redhat.com>
To: qemu-devel@nongnu.org, lcapitulino@redhat.com, aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH] ui/input.c: replace magic numbers by macros
Date: Mon, 22 Apr 2013 16:25:29 +0800 [thread overview]
Message-ID: <1366619129-23189-1-git-send-email-akong@redhat.com> (raw)
In-Reply-To: <20130422073252.GC1938@t430s.nay.redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
---
It's based on http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg03822.html
---
ui/input.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ui/input.c b/ui/input.c
index 143c421..fac5d6d 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -28,6 +28,7 @@
#include "qapi/error.h"
#include "qmp-commands.h"
#include "qapi-types.h"
+#include "ui/keymaps.h"
static QEMUPutKBDEvent *qemu_put_kbd_event;
static void *qemu_put_kbd_event_opaque;
@@ -239,10 +240,10 @@ static void enter_keys(void *opaque)
/* key down events */
for (i = 0; i < keycodes_size; i++) {
- if (keycodes[i] & 0x80) {
- kbd_put_keycode(0xe0);
+ if (keycodes[i] & SCANCODE_GREY) {
+ kbd_put_keycode(SCANCODE_EMUL0);
}
- kbd_put_keycode(keycodes[i] & 0x7f);
+ kbd_put_keycode(keycodes[i] & SCANCODE_KEYCODEMASK);
}
rest_time -= 100;
@@ -255,10 +256,10 @@ static void enter_keys(void *opaque)
/* key up events */
while (keycodes_size > 0) {
- if (keycodes[--keycodes_size] & 0x80) {
- kbd_put_keycode(0xe0);
+ if (keycodes[--keycodes_size] & SCANCODE_GREY) {
+ kbd_put_keycode(SCANCODE_EMUL0);
}
- kbd_put_keycode(keycodes[keycodes_size] | 0x80);
+ kbd_put_keycode(keycodes[keycodes_size] | SCANCODE_UP);
}
free_keycodes();
--
1.7.1
next prev parent reply other threads:[~2013-04-22 8:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 4:44 [Qemu-devel] [PATCH] monitor: intervally send down events to guest in hold time Amos Kong
2013-04-20 16:06 ` Eric Blake
2013-04-22 7:32 ` Amos Kong
2013-04-22 8:09 ` Amos Kong
2013-04-22 9:33 ` Paolo Bonzini
2013-04-22 12:43 ` Luiz Capitulino
2013-04-22 13:03 ` Paolo Bonzini
2013-04-22 13:35 ` Gerd Hoffmann
2013-04-22 14:32 ` Paolo Bonzini
2013-04-22 15:20 ` Gerd Hoffmann
2013-04-22 15:41 ` Paolo Bonzini
2013-04-22 14:02 ` Anthony Liguori
2013-04-22 14:22 ` Luiz Capitulino
2013-04-23 2:24 ` Amos Kong
2013-04-22 8:25 ` Amos Kong [this message]
2013-04-22 16:25 ` Eric Blake
2013-05-14 12:42 ` Laszlo Ersek
2013-05-14 14:55 ` Anthony Liguori
2013-05-15 8:13 ` Amos Kong
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=1366619129-23189-1-git-send-email-akong@redhat.com \
--to=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=lcapitulino@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).