diff options
author | Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> | 2015-09-17 19:25:24 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-11-06 10:16:03 +0100 |
commit | ee312992a323530ea2cda8680f3a34746c72db8f (patch) | |
tree | 46353dc8d69e2c593b7f1695a93ddb35e974584e /replay/replay-events.c | |
parent | 4c27b859722089e0270fd4f41b4b3c63b6647439 (diff) | |
download | qemu-ee312992a323530ea2cda8680f3a34746c72db8f.zip qemu-ee312992a323530ea2cda8680f3a34746c72db8f.tar.gz qemu-ee312992a323530ea2cda8680f3a34746c72db8f.tar.bz2 |
replay: recording of the user input
This records user input (keyboard and mouse events) in record mode and replays
these input events in replay mode.
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162524.8676.11696.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Diffstat (limited to 'replay/replay-events.c')
-rw-r--r-- | replay/replay-events.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/replay/replay-events.c b/replay/replay-events.c index 8db2c7a..402f644 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -14,6 +14,7 @@ #include "sysemu/replay.h" #include "replay-internal.h" #include "block/aio.h" +#include "ui/input.h" typedef struct Event { ReplayAsyncEventKind event_kind; @@ -39,6 +40,13 @@ static void replay_run_event(Event *event) case REPLAY_ASYNC_EVENT_BH: aio_bh_call(event->opaque); break; + case REPLAY_ASYNC_EVENT_INPUT: + qemu_input_event_send_impl(NULL, (InputEvent *)event->opaque); + qapi_free_InputEvent((InputEvent *)event->opaque); + break; + case REPLAY_ASYNC_EVENT_INPUT_SYNC: + qemu_input_event_sync_impl(); + break; default: error_report("Replay: invalid async event ID (%d) in the queue", event->event_kind); @@ -131,6 +139,16 @@ void replay_bh_schedule_event(QEMUBH *bh) } } +void replay_add_input_event(struct InputEvent *event) +{ + replay_add_event(REPLAY_ASYNC_EVENT_INPUT, event, NULL, 0); +} + +void replay_add_input_sync_event(void) +{ + replay_add_event(REPLAY_ASYNC_EVENT_INPUT_SYNC, NULL, NULL, 0); +} + static void replay_save_event(Event *event, int checkpoint) { if (replay_mode != REPLAY_MODE_PLAY) { @@ -144,6 +162,11 @@ static void replay_save_event(Event *event, int checkpoint) case REPLAY_ASYNC_EVENT_BH: replay_put_qword(event->id); break; + case REPLAY_ASYNC_EVENT_INPUT: + replay_save_input_event(event->opaque); + break; + case REPLAY_ASYNC_EVENT_INPUT_SYNC: + break; default: error_report("Unknown ID %d of replay event", read_event_kind); exit(1); @@ -187,6 +210,16 @@ static Event *replay_read_event(int checkpoint) read_id = replay_get_qword(); } break; + case REPLAY_ASYNC_EVENT_INPUT: + event = g_malloc0(sizeof(Event)); + event->event_kind = read_event_kind; + event->opaque = replay_read_input_event(); + return event; + case REPLAY_ASYNC_EVENT_INPUT_SYNC: + event = g_malloc0(sizeof(Event)); + event->event_kind = read_event_kind; + event->opaque = 0; + return event; default: error_report("Unknown ID %d of replay event", read_event_kind); exit(1); |