From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Gerd Hoffmann Date: Wed, 15 Feb 2012 09:15:37 +0100 Message-Id: <1329293737-20683-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] input: send kbd+mouse events only to running guests. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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; } -- 1.7.1