[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/10] input: add qemu_input_key_number_to_qcode
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 02/10] input: add qemu_input_key_number_to_qcode |
Date: |
Mon, 26 May 2014 09:51:18 +0200 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
include/ui/input.h | 1 +
ui/input-keymap.c | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/ui/input.h b/include/ui/input.h
index 3d3d487..d84ed8b 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -36,6 +36,7 @@ InputEvent *qemu_input_event_new_key(KeyValue *key, bool
down);
void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down);
void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down);
void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down);
+int qemu_input_key_number_to_qcode(uint8_t nr);
int qemu_input_key_value_to_number(const KeyValue *value);
int qemu_input_key_value_to_qcode(const KeyValue *value);
int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index 6da4495..4c4f0d0 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -129,7 +129,7 @@ static const int qcode_to_number[] = {
[Q_KEY_CODE_MAX] = 0,
};
-static int number_to_qcode[0xff];
+static int number_to_qcode[0x100];
int qemu_input_key_value_to_number(const KeyValue *value)
{
@@ -141,7 +141,7 @@ int qemu_input_key_value_to_number(const KeyValue *value)
}
}
-int qemu_input_key_value_to_qcode(const KeyValue *value)
+int qemu_input_key_number_to_qcode(uint8_t nr)
{
static int first = true;
@@ -155,11 +155,16 @@ int qemu_input_key_value_to_qcode(const KeyValue *value)
}
}
+ return number_to_qcode[nr];
+}
+
+int qemu_input_key_value_to_qcode(const KeyValue *value)
+{
if (value->kind == KEY_VALUE_KIND_QCODE) {
return value->qcode;
} else {
assert(value->kind == KEY_VALUE_KIND_NUMBER);
- return number_to_qcode[value->number];
+ return qemu_input_key_number_to_qcode(value->number);
}
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/10] input: add event routing and multiseat support., Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 01/10] input (curses): mask keycodes to remove modifier bits, Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 05/10] input: switch hid keyboard to new input layer api., Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 04/10] input: keymap: add meta keys, Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 09/10] usb: add input routing support for tablet and keyboard, Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 02/10] input: add qemu_input_key_number_to_qcode,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 07/10] input: bind devices and input routing, Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 08/10] sdl: pass key event source to input layer, Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 06/10] input: switch hid mouse and tablet to the new input layer api., Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 10/10] docs: add multiseat.txt, Gerd Hoffmann, 2014/05/26
- [Qemu-devel] [PULL 03/10] input: add name to input_event_key_number, Gerd Hoffmann, 2014/05/26
- Re: [Qemu-devel] [PULL 00/10] input: add event routing and multiseat support., Peter Maydell, 2014/05/28