aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorAmos Kong <akong@redhat.com>2013-05-16 13:19:47 +0800
committerLuiz Capitulino <lcapitulino@redhat.com>2013-05-23 09:58:45 -0400
commitb2d1674b75563326515cf2178cc1d0a002797a12 (patch)
tree46e3e743f59e283a286debbffadee78c5ad13aa7 /ui
parent199e0f17f23a68c8d619e9e623d970324ed5efc1 (diff)
downloadqemu-b2d1674b75563326515cf2178cc1d0a002797a12.zip
qemu-b2d1674b75563326515cf2178cc1d0a002797a12.tar.gz
qemu-b2d1674b75563326515cf2178cc1d0a002797a12.tar.bz2
ui/input.c: replace magic numbers with macros
It's clearer to use defined macros than magic numbers. Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/input.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/input.c b/ui/input.c
index 8ca1a03..92c44ca 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"
struct QEMUPutMouseEntry {
QEMUPutMouseEvent *qemu_put_mouse_event;
@@ -260,10 +261,10 @@ static void free_keycodes(void)
static void release_keys(void *opaque)
{
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();
@@ -297,10 +298,10 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
return;
}
- if (keycode & 0x80) {
- kbd_put_keycode(0xe0);
+ if (keycode & SCANCODE_GREY) {
+ kbd_put_keycode(SCANCODE_EMUL0);
}
- kbd_put_keycode(keycode & 0x7f);
+ kbd_put_keycode(keycode & SCANCODE_KEYCODEMASK);
keycodes = g_realloc(keycodes, sizeof(int) * (keycodes_size + 1));
keycodes[keycodes_size++] = keycode;