summaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2012-04-27 13:33:36 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2012-05-08 14:30:09 -0300
commitad02b96ad86baf6dd72a43b04876b2d6ea957112 (patch)
tree3f069ea707475c64c7aa8e306b9bfbe2c27f2395 /input.c
parent0a24c7b18eefcd1138a5c60fc77bc9b653c64082 (diff)
downloadqemu-ad02b96ad86baf6dd72a43b04876b2d6ea957112.tar.gz
qemu-ad02b96ad86baf6dd72a43b04876b2d6ea957112.tar.bz2
qemu-ad02b96ad86baf6dd72a43b04876b2d6ea957112.zip
runstate: introduce suspended state
QEMU enters in this state when the guest suspends to ram (S3). This is important so that HMP users and QMP clients can know that the guest is suspended. QMP also has an event for this, but events are not reliable and are limited (ie. a client can connect to QEMU after the event has been emitted). Having a different state for S3 brings a new issue, though. Every device that doesn't run when the VM is stopped but wants to run when the VM is suspended has to check for RUN_STATE_SUSPENDED explicitly. This is the case for the keyboard and mouse devices, for example. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'input.c')
-rw-r--r--input.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/input.c b/input.c
index 6b5c2c3371..6968b31781 100644
--- a/input.c
+++ b/input.c
@@ -130,7 +130,7 @@ void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry)
void kbd_put_keycode(int keycode)
{
- if (!runstate_is_running()) {
+ if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
return;
}
if (qemu_put_kbd_event) {
@@ -154,7 +154,7 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state)
void *mouse_event_opaque;
int width, height;
- if (!runstate_is_running()) {
+ if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
return;
}
if (QTAILQ_EMPTY(&mouse_handlers)) {