On Tue, 2017-09-12 at 13:37 +0100, Daniel P. Berrange wrote:
> Always use QKeyCode in the InputKeyEvent struct, by converting key
> numbers to QKeyCode at the time the event is created.
> 
> Signed-off-by: Daniel P. Berrange <[email protected]>

qmp_input_send_event() must be handled too as patches later in this
series depend on never seeing any KEY_VALUE_KIND_NUMBER key events.

cheers,
  Gerd

@@ -157,9 +157,16 @@ void qmp_input_send_event(bool has_device, const
char *device,
     }
 
     for (e = events; e != NULL; e = e->next) {
-        InputEvent *event = e->value;
+        InputEvent *evt = e->value;
 
-        qemu_input_event_send(con, event);
+        if (evt->type == INPUT_EVENT_KIND_KEY &&
+            evt->u.key.data->key->type == KEY_VALUE_KIND_NUMBER) {
+            KeyValue *key = evt->u.key.data->key;
+            QKeyCode code = qemu_input_key_number_to_qcode(key-
>u.qcode.data);
+            qemu_input_event_send_key_qcode(con, code, evt-
>u.key.data->down);
+        } else {
+            qemu_input_event_send(con, evt);
+        }
     }

Reply via email to