From b78635f68a670139a29bf9f0ee16d11dbc2146bb Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 29 Feb 2012 12:58:17 +0100 Subject: [PATCH 2/3] input: send kbd+mouse events only to running guests. RH-Author: Gerd Hoffmann Message-id: <1330520297-7933-1-git-send-email-kraxel@redhat.com> Patchwork-id: 37777 O-Subject: [RHEL-6.3 qemu-kvm PATCH] input: send kbd+mouse events only to running guests. Bugzilla: 788027 RH-Acked-by: Alon Levy RH-Acked-by: Paolo Bonzini RH-Acked-by: Alex Williamson 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 Signed-off-by: Anthony Liguori (cherry picked from commit 99c7f87826337fa81f2f0f9baa9ca0a44faf90e9) Conflicts: input.c [ rhel6: code is still in vl.c ] Bugzilla: 788027 - Spice and vnc connection buffer keyboard and mouse event after guest stopped --- vl.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- vl.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index 48ec0b3..b3275b0 100644 --- a/vl.c +++ b/vl.c @@ -623,6 +623,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); } @@ -650,6 +653,9 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state) void *mouse_event_opaque; int width; + if (!runstate_is_running()) { + return; + } if (QTAILQ_EMPTY(&mouse_handlers)) { return; } -- 1.7.7.6