#include <palacios/vmm.h>
#include <palacios/vmm_host_events.h>
-
+#include <palacios/vm_guest.h>
int v3_init_host_events(struct guest_info * info) {
struct v3_host_events * host_evts = &(info->host_event_hooks);
struct v3_host_events * host_evts = &(info->host_event_hooks);
struct v3_host_event_hook * hook = NULL;
+ if (info->run_state != VM_RUNNING) {
+ return -1;
+ }
+
list_for_each_entry(hook, &(host_evts->keyboard_events), link) {
if (hook->cb.keyboard_handler(info, evt, hook->private_data) == -1) {
return -1;
struct v3_host_events * host_evts = &(info->host_event_hooks);
struct v3_host_event_hook * hook = NULL;
+ if (info->run_state != VM_RUNNING) {
+ return -1;
+ }
+
list_for_each_entry(hook, &(host_evts->mouse_events), link) {
if (hook->cb.mouse_handler(info, evt, hook->private_data) == -1) {
return -1;
struct v3_host_events * host_evts = &(info->host_event_hooks);
struct v3_host_event_hook * hook = NULL;
+ if (info->run_state != VM_RUNNING) {
+ return -1;
+ }
+
list_for_each_entry(hook, &(host_evts->timer_events), link) {
if (hook->cb.timer_handler(info, evt, hook->private_data) == -1) {
return -1;