/* Send a keyboard (or mouse button) event */ static int xenfb_send_key(struct XenInput *xenfb, bool down, int keycode) { union xenkbd_in_event event; memset(&event, 0, XENKBD_IN_EVENT_SIZE); event.type = XENKBD_TYPE_KEY; event.key.pressed = down ? 1 : 0; event.key.keycode = keycode; return xenfb_kbd_event(xenfb, &event); }
/* Send an absolute mouse movement event */ static int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y, int abs_z) { union xenkbd_in_event event; memset(&event, 0, XENKBD_IN_EVENT_SIZE); event.type = XENKBD_TYPE_POS; event.pos.abs_x = abs_x; event.pos.abs_y = abs_y; event.pos.abs_z = abs_z; return xenfb_kbd_event(xenfb, &event); }
/* Send a relative mouse movement event */ static int xenfb_send_motion(struct xenfb *xenfb, int rel_x, int rel_y, int rel_z) { union xenkbd_in_event event; memset(&event, 0, XENKBD_IN_EVENT_SIZE); event.type = XENKBD_TYPE_MOTION; event.motion.rel_x = rel_x; event.motion.rel_y = rel_y; event.motion.rel_z = rel_z; return xenfb_kbd_event(xenfb, &event); }
/* Send a relative mouse movement event */ static int xenfb_send_motion(struct XenInput *xenfb, int rel_x, int rel_y, int rel_z) { union xenkbd_in_event event; memset(&event, 0, XENKBD_IN_EVENT_SIZE); event.type = XENKBD_TYPE_MOTION; event.motion.rel_x = rel_x; event.motion.rel_y = rel_y; #if __XEN_LATEST_INTERFACE_VERSION__ >= 0x00030207 event.motion.rel_z = rel_z; #endif return xenfb_kbd_event(xenfb, &event); }
/* Send an absolute mouse movement event */ static int xenfb_send_position(struct XenInput *xenfb, int abs_x, int abs_y, int z) { union xenkbd_in_event event; memset(&event, 0, XENKBD_IN_EVENT_SIZE); event.type = XENKBD_TYPE_POS; event.pos.abs_x = abs_x; event.pos.abs_y = abs_y; #if __XEN_LATEST_INTERFACE_VERSION__ == 0x00030207 event.pos.abs_z = z; #endif #if __XEN_LATEST_INTERFACE_VERSION__ >= 0x00030208 event.pos.rel_z = z; #endif return xenfb_kbd_event(xenfb, &event); }