qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] input: send kbd+mouse events only to running guests.
@ 2012-02-15  8:15 Gerd Hoffmann
  2012-02-17 18:17 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2012-02-15  8:15 UTC (permalink / raw)
  To: qemu-devel; +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 <kraxel@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-17 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15  8:15 [Qemu-devel] [PATCH] input: send kbd+mouse events only to running guests Gerd Hoffmann
2012-02-17 18:17 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).