]> git.proxmox.com Git - mirror_qemu.git/commitdiff
input: add qemu_input_key_number_to_qcode
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 21 May 2014 11:28:32 +0000 (13:28 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 26 May 2014 06:42:42 +0000 (08:42 +0200)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
include/ui/input.h
ui/input-keymap.c

index 3d3d487f18751f8e61affef6c322d4b870cc3b70..d84ed8b41cebd87f7784b20a75e6a16d4965c385 100644 (file)
@@ -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,
index 6da4495103cc6f7afcea6d8cf2eb9628f6440a86..4c4f0d03a961cf05fc262f41a3f51db2ab5cc023 100644 (file)
@@ -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);
     }
 }