summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-02-15 09:15:37 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-17 11:02:55 -0600
commit99c7f87826337fa81f2f0f9baa9ca0a44faf90e9 (patch)
treeb1d566fafc30056e45d845a980bd7fda3e090393 /input.c
parentaa24822bdc7c4e74afbc6fa1324b01cf067da7cb (diff)
input: send kbd+mouse events only to running guests.
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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'input.c')
-rw-r--r--input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/input.c b/input.c
index b618ea4c1c..6b5c2c3371 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;
}