From patchwork Fri Sep 26 07:44:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 393547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0818814012C for ; Fri, 26 Sep 2014 17:45:23 +1000 (EST) Received: from localhost ([::1]:45195 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXQDR-0002AG-9F for incoming@patchwork.ozlabs.org; Fri, 26 Sep 2014 03:45:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXQD6-0001ox-AQ for qemu-devel@nongnu.org; Fri, 26 Sep 2014 03:45:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXQCy-00051J-QJ for qemu-devel@nongnu.org; Fri, 26 Sep 2014 03:45:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXQCy-00050s-JG for qemu-devel@nongnu.org; Fri, 26 Sep 2014 03:44:52 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8Q7ih6w001917 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Sep 2014 03:44:44 -0400 Received: from air.nay.redhat.com (vpn1-112-225.nay.redhat.com [10.66.112.225]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8Q7idmD019703; Fri, 26 Sep 2014 03:44:40 -0400 From: Amos Kong To: qemu-devel@nongnu.org Date: Fri, 26 Sep 2014 15:44:40 +0800 Message-Id: <1411717480-31299-1-git-send-email-akong@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com, aliguori@amazon.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH] ui/input: correct the release order of combined keys X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit 2e377f17 wrongly overturned the release order of combined keys, it caused some Windows guests can't be paniced by "virsh send-key KEY_RIGHTCTRL KEY_SCROLLLOCK KEY_SCROLLLOCK" The press event order should be different with release order. Signed-off-by: Amos Kong --- 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); }