8 typedef struct HIDPointerEvent {
9 int32_t xdx, ydy; /* relative iff it's a mouse, otherwise absolute */
10 int32_t dz, buttons_state;
13 #define QUEUE_LENGTH 16 /* should be enough for a triple-click */
14 #define QUEUE_MASK (QUEUE_LENGTH-1u)
15 #define QUEUE_INCR(v) ((v)++, (v) &= QUEUE_MASK)
17 typedef struct HIDState HIDState;
18 typedef void (*HIDEventFunc)(HIDState *s);
20 typedef struct HIDMouseState {
21 HIDPointerEvent queue[QUEUE_LENGTH];
23 QEMUPutMouseEntry *eh_entry;
26 typedef struct HIDKeyboardState {
27 uint32_t keycodes[QUEUE_LENGTH];
39 uint32_t head; /* index into circular queue */
44 int64_t next_idle_clock;
48 void hid_init(HIDState *hs, int kind, HIDEventFunc event);
49 void hid_reset(HIDState *hs);
50 void hid_free(HIDState *hs);
52 bool hid_has_events(HIDState *hs);
53 void hid_set_next_idle(HIDState *hs, int64_t curtime);
54 void hid_pointer_activate(HIDState *hs);
55 int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len);
56 int hid_keyboard_poll(HIDState *hs, uint8_t *buf, int len);
57 int hid_keyboard_write(HIDState *hs, uint8_t *buf, int len);
59 #endif /* QEMU_HID_H */