return i;
}
-static KeyValue *copy_key_value(KeyValue *src)
-{
- KeyValue *dst = g_new(KeyValue, 1);
- memcpy(dst, src, sizeof(*src));
- if (dst->type == KEY_VALUE_KIND_NUMBER) {
- QKeyCode code = qemu_input_key_number_to_qcode(dst->u.number.data);
- dst->type = KEY_VALUE_KIND_QCODE;
- dst->u.qcode.data = code;
- }
- return dst;
-}
-
void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
Error **errp)
{
KeyValueList *p;
- KeyValue **up = NULL;
+ unsigned int *up = NULL;
int count = 0;
if (!has_hold_time) {
}
for (p = keys; p != NULL; p = p->next) {
- qemu_input_event_send_key(NULL, copy_key_value(p->value), true);
- qemu_input_event_send_key_delay(hold_time);
up = g_realloc(up, sizeof(*up) * (count+1));
- up[count] = copy_key_value(p->value);
+ up[count] = qemu_input_key_value_to_linux(p->value);
+ qemu_input_event_send_key_linux(NULL, up[count], true);
+ qemu_input_event_send_key_delay(hold_time);
count++;
}
while (count) {
count--;
- qemu_input_event_send_key(NULL, up[count], false);
+ qemu_input_event_send_key_linux(NULL, up[count], false);
qemu_input_event_send_key_delay(hold_time);
}
g_free(up);