From patchwork Wed Feb 15 08:15:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 141264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4070A1007D5 for ; Wed, 15 Feb 2012 19:15:56 +1100 (EST) Received: from localhost ([::1]:36659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rxa1p-0007gb-CW for incoming@patchwork.ozlabs.org; Wed, 15 Feb 2012 03:15:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]:54719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rxa1g-0007gV-8Z for qemu-devel@nongnu.org; Wed, 15 Feb 2012 03:15:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rxa1c-0000ie-2n for qemu-devel@nongnu.org; Wed, 15 Feb 2012 03:15:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rxa1b-0000iW-Sc for qemu-devel@nongnu.org; Wed, 15 Feb 2012 03:15:40 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1F8Fdxk020212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 15 Feb 2012 03:15:39 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1F8Fcre010475; Wed, 15 Feb 2012 03:15:38 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 3EAB940A16; Wed, 15 Feb 2012 09:15:37 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 15 Feb 2012 09:15:37 +0100 Message-Id: <1329293737-20683-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] input: send kbd+mouse events only to running guests. 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 Trying to interact with a stopped guest will queue up the events, then send them all at once when the guest continues running, with a high chance to have them cause unwanted actions. Avoid that by only injecting the input events only when the guest is in running state. Signed-off-by: Gerd Hoffmann --- input.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/input.c b/input.c index 9ade63f..b48408d 100644 --- a/input.c +++ b/input.c @@ -130,6 +130,9 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry) void kbd_put_keycode(int keycode) { + if (!runstate_is_running()) { + return; + } if (qemu_put_kbd_event) { qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode); } @@ -151,6 +154,9 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state) void *mouse_event_opaque; int width, height; + if (!runstate_is_running()) { + return; + } if (QTAILQ_EMPTY(&mouse_handlers)) { return; }