qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ui/input: correct the release order of combined keys
@ 2014-09-26  7:44 Amos Kong
  0 siblings, 0 replies; only message in thread
From: Amos Kong @ 2014-09-26  7:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel, aliguori, lcapitulino

Commit 2e377f17 wrongly overturned the release order of combined keys,
it caused some Windows guests can't be paniced by "virsh send-key
<domain> KEY_RIGHTCTRL KEY_SCROLLLOCK KEY_SCROLLLOCK"

The press event order should be different with release order.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 ui/input-legacy.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index 3025f50..1e1f14c 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -85,16 +85,23 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
                   Error **errp)
 {
     KeyValueList *p;
+    int count, i;
 
     if (!has_hold_time) {
         hold_time = 0; /* use default */
     }
 
+    count = 0;
     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);
+        count++;
     }
-    for (p = keys; p != NULL; p = p->next) {
+    while (count--) {
+        i = 0;
+        for (p = keys; p != NULL && i < count; p = p->next) {
+            i++;
+        }
         qemu_input_event_send_key(NULL, copy_key_value(p->value), false);
         qemu_input_event_send_key_delay(hold_time);
     }
-- 
1.9.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-26  7:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-26  7:44 [Qemu-devel] [PATCH] ui/input: correct the release order of combined keys Amos Kong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).