[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/12] ui/input.c: replace magic numbers with macros
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 11/12] ui/input.c: replace magic numbers with macros |
Date: |
Thu, 23 May 2013 14:20:31 -0400 |
From: Amos Kong <address@hidden>
It's clearer to use defined macros than magic numbers.
Signed-off-by: Amos Kong <address@hidden>
Reviewed-by: Lei Li <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
ui/input.c | 13 +++++++------
1 file 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;
--
1.8.1.4
- [Qemu-devel] [PULL 00/12] QMP queue, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 01/12] qapi: qapi-types.py, native list support, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 02/12] qapi: qapi-visit.py, fix list handling for union types, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 03/12] qapi: qapi-visit.py, native list support, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 05/12] json-parser: fix handling of large whole number values, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 06/12] qapi: add QMP input test for large integers, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 04/12] qapi: enable generation of native list code, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 07/12] qapi: fix visitor serialization tests for numbers/doubles, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 12/12] monitor: allow to disable the default monitor, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 08/12] qapi: add native list coverage for visitor serialization tests, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 11/12] ui/input.c: replace magic numbers with macros,
Luiz Capitulino <=
- [Qemu-devel] [PULL 10/12] qapi: add native list coverage for QMP input visitor tests, Luiz Capitulino, 2013/05/23
- [Qemu-devel] [PULL 09/12] qapi: add native list coverage for QMP output visitor tests, Luiz Capitulino, 2013/05/23