Now that keycode numbers are converted to QKeyCodes immediately
when creating input events, the InputKeyEvent struct can be
changed to only accept a QKeyCode, instead of a KeyValue.
Signed-off-by: Daniel P. Berrange
---
hw/char/escc.c | 2 +-
hw/input/adb.c | 2 +-
hw/input/hid.c | 6 +++---
hw/input/ps2.c | 2 +-
hw/input/virtio-input-hid.c | 2 +-
include/ui/input.h | 7 ++-
qapi-schema.json| 2 +-
replay/replay-input.c | 36 --
ui/input-keymap.c | 32 --
ui/input-legacy.c | 31 +-
ui/input.c | 47 +
ui/trace-events | 1 -
12 files changed, 53 insertions(+), 117 deletions(-)
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 1aca564e33..5af7f0cddf 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -847,7 +847,7 @@ static void sunkbd_handle_event(DeviceState *dev,
QemuConsole *src,
assert(evt->type == INPUT_EVENT_KIND_KEY);
key = evt->u.key.data;
-qcode = qemu_input_key_value_to_qcode(key->key);
+qcode = key->key;
trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode],
key->down);
diff --git a/hw/input/adb.c b/hw/input/adb.c
index fcca3a8eb9..992f5bd1c4 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -438,7 +438,7 @@ static void adb_keyboard_event(DeviceState *dev,
QemuConsole *src,
KBDState *s = (KBDState *)dev;
int qcode, keycode;
-qcode = qemu_input_key_value_to_qcode(evt->u.key.data->key);
+qcode = evt->u.key.data->key;
if (qcode >= ARRAY_SIZE(qcode_to_adb_keycode)) {
return;
}
diff --git a/hw/input/hid.c b/hw/input/hid.c
index 0d049ff61c..fdb77b8b2a 100644
--- a/hw/input/hid.c
+++ b/hw/input/hid.c
@@ -231,9 +231,9 @@ static void hid_keyboard_event(DeviceState *dev,
QemuConsole *src,
int slot;
InputKeyEvent *key = evt->u.key.data;
-count = qemu_input_key_value_to_scancode(key->key,
- key->down,
- scancodes);
+count = qemu_input_qcode_to_scancode(key->key,
+ key->down,
+ scancodes);
if (hs->n + count > QUEUE_LENGTH) {
trace_hid_kbd_queue_full();
return;
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 77906d5f46..14b1d85f6c 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -599,7 +599,7 @@ static void ps2_keyboard_event(DeviceState *dev,
QemuConsole *src,
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
assert(evt->type == INPUT_EVENT_KIND_KEY);
-qcode = qemu_input_key_value_to_qcode(key->key);
+qcode = key->key;
if (s->scancode_set == 1) {
if (qcode == Q_KEY_CODE_PAUSE) {
diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index 46c038110c..7a04e21b33 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -200,7 +200,7 @@ static void virtio_input_handle_event(DeviceState *dev,
QemuConsole *src,
switch (evt->type) {
case INPUT_EVENT_KIND_KEY:
key = evt->u.key.data;
-qcode = qemu_input_key_value_to_qcode(key->key);
+qcode = key->key;
if (qcode && keymap_qcode[qcode]) {
event.type = cpu_to_le16(EV_KEY);
event.code = cpu_to_le16(keymap_qcode[qcode]);
diff --git a/include/ui/input.h b/include/ui/input.h
index 576006c370..5577cbcb04 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -38,15 +38,12 @@ void qemu_input_event_send_impl(QemuConsole *src,
InputEvent *evt);
void qemu_input_event_sync(void);
void qemu_input_event_sync_impl(void);
-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);
void qemu_input_event_send_key_delay(uint32_t delay_ms);
int qemu_input_key_number_to_qcode(unsigned int 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,
- int *codes);
+int qemu_input_qcode_to_number(QKeyCode qcode);
+int qemu_input_qcode_to_scancode(QKeyCode qcode, bool down, int *codes);
int qemu_input_linux_to_qcode(unsigned int lnx);
InputEvent *qemu_input_event_new_btn(InputButton btn, bool down);
diff --git a/qapi-schema.json b/qapi-schema.json
index 802ea53d00..fa6e99ee9c 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -5747,7 +5747,7 @@
# Since: 2.0
##
{ 'struct' : 'InputKeyEvent',
- 'data' : { 'key' : 'KeyValue',
+ 'data' : { 'key' : 'QKeyCode',