aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-05-28 13:03:37 +0200
committerGerd Hoffmann <kraxel@redhat.com>2014-06-04 08:40:41 +0200
commit2e377f1730d06deafb3e3ef6cf88792de4a6f4df (patch)
treecf59f504f49676d8d22ce13710ab61a5fd08e3b6 /ui
parentbe1a7176249ddf0be179d79e4f9c86b2ad42997b (diff)
input: use kbd delays for send_key monitor command
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/input-legacy.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index 2a538607a2..3025f50f49 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -74,27 +74,6 @@ int index_from_key(const char *key)
return i;
}
-static KeyValue **keyvalues;
-static int keyvalues_size;
-static QEMUTimer *key_timer;
-
-static void free_keyvalues(void)
-{
- g_free(keyvalues);
- keyvalues = NULL;
- keyvalues_size = 0;
-}
-
-static void release_keys(void *opaque)
-{
- while (keyvalues_size > 0) {
- qemu_input_event_send_key(NULL, keyvalues[--keyvalues_size],
- false);
- }
-
- free_keyvalues();
-}
-
static KeyValue *copy_key_value(KeyValue *src)
{
KeyValue *dst = g_new(KeyValue, 1);
@@ -107,30 +86,18 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
{
KeyValueList *p;
- if (!key_timer) {
- key_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, release_keys, NULL);
- }
-
- if (keyvalues != NULL) {
- timer_del(key_timer);
- release_keys(NULL);
- }
-
if (!has_hold_time) {
- hold_time = 100;
+ hold_time = 0; /* use default */
}
for (p = keys; p != NULL; p = p->next) {
qemu_input_event_send_key(NULL, copy_key_value(p->value), true);
-
- keyvalues = g_realloc(keyvalues, sizeof(KeyValue *) *
- (keyvalues_size + 1));
- keyvalues[keyvalues_size++] = copy_key_value(p->value);
+ qemu_input_event_send_key_delay(hold_time);
+ }
+ for (p = keys; p != NULL; p = p->next) {
+ qemu_input_event_send_key(NULL, copy_key_value(p->value), false);
+ qemu_input_event_send_key_delay(hold_time);
}
-
- /* delayed key up events */
- timer_mod(key_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
- muldiv64(get_ticks_per_sec(), hold_time, 1000));
}
static void legacy_kbd_event(DeviceState *dev, QemuConsole *src,