peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0402-input-send-kbd-mouse-events-only-to-running-guests.patch

56753f
From f87b93c3944652f90e2c0010da6ee8c182382369 Mon Sep 17 00:00:00 2001
56753f
From: Gerd Hoffmann <kraxel@redhat.com>
56753f
Date: Wed, 15 Feb 2012 09:15:37 +0100
56753f
Subject: [PATCH 402/434] input: send kbd+mouse events only to running guests.
56753f
56753f
Trying to interact with a stopped guest will queue up the events,
56753f
then send them all at once when the guest continues running, with
56753f
a high chance to have them cause unwanted actions.
56753f
56753f
Avoid that by only injecting the input events only when the guest
56753f
is in running state.
56753f
56753f
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
56753f
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
56753f
---
56753f
 input.c |    6 ++++++
56753f
 1 file changed, 6 insertions(+)
56753f
56753f
diff --git a/input.c b/input.c
56753f
index 9ade63f..b48408d 100644
56753f
--- a/input.c
56753f
+++ b/input.c
56753f
@@ -130,6 +130,9 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry)
56753f
 
56753f
 void kbd_put_keycode(int keycode)
56753f
 {
56753f
+    if (!runstate_is_running()) {
56753f
+        return;
56753f
+    }
56753f
     if (qemu_put_kbd_event) {
56753f
         qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode);
56753f
     }
56753f
@@ -151,6 +154,9 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
56753f
     void *mouse_event_opaque;
56753f
     int width, height;
56753f
 
56753f
+    if (!runstate_is_running()) {
56753f
+        return;
56753f
+    }
56753f
     if (QTAILQ_EMPTY(&mouse_handlers)) {
56753f
         return;
56753f
     }
56753f
-- 
56753f
1.7.10
56753f