]>
Commit | Line | Data |
---|---|---|
c8b405b6 GH |
1 | #ifndef INPUT_H |
2 | #define INPUT_H | |
3 | ||
4 | #include "qapi-types.h" | |
5 | ||
6 | #define INPUT_EVENT_MASK_KEY (1<<INPUT_EVENT_KIND_KEY) | |
7 | #define INPUT_EVENT_MASK_BTN (1<<INPUT_EVENT_KIND_BTN) | |
8 | #define INPUT_EVENT_MASK_REL (1<<INPUT_EVENT_KIND_REL) | |
9 | #define INPUT_EVENT_MASK_ABS (1<<INPUT_EVENT_KIND_ABS) | |
10 | ||
43579403 GH |
11 | #define INPUT_EVENT_ABS_SIZE 0x8000 |
12 | ||
c8b405b6 GH |
13 | typedef struct QemuInputHandler QemuInputHandler; |
14 | typedef struct QemuInputHandlerState QemuInputHandlerState; | |
15 | ||
16 | typedef void (*QemuInputHandlerEvent)(DeviceState *dev, QemuConsole *src, | |
17 | InputEvent *evt); | |
18 | typedef void (*QemuInputHandlerSync)(DeviceState *dev); | |
19 | ||
20 | struct QemuInputHandler { | |
21 | const char *name; | |
22 | uint32_t mask; | |
23 | QemuInputHandlerEvent event; | |
24 | QemuInputHandlerSync sync; | |
25 | }; | |
26 | ||
27 | QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev, | |
28 | QemuInputHandler *handler); | |
29 | void qemu_input_handler_activate(QemuInputHandlerState *s); | |
528728fd | 30 | void qemu_input_handler_deactivate(QemuInputHandlerState *s); |
c8b405b6 | 31 | void qemu_input_handler_unregister(QemuInputHandlerState *s); |
6f5943cf GH |
32 | void qemu_input_handler_bind(QemuInputHandlerState *s, |
33 | const char *device_id, int head, | |
34 | Error **errp); | |
c8b405b6 | 35 | void qemu_input_event_send(QemuConsole *src, InputEvent *evt); |
ee312992 | 36 | void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt); |
c8b405b6 | 37 | void qemu_input_event_sync(void); |
ee312992 | 38 | void qemu_input_event_sync_impl(void); |
c8b405b6 | 39 | |
65671475 GH |
40 | InputEvent *qemu_input_event_new_key(KeyValue *key, bool down); |
41 | void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down); | |
42 | void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down); | |
43 | void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down); | |
be1a7176 | 44 | void qemu_input_event_send_key_delay(uint32_t delay_ms); |
11c7fa7f | 45 | int qemu_input_key_number_to_qcode(uint8_t nr); |
02aa76c2 GH |
46 | int qemu_input_key_value_to_number(const KeyValue *value); |
47 | int qemu_input_key_value_to_qcode(const KeyValue *value); | |
48 | int qemu_input_key_value_to_scancode(const KeyValue *value, bool down, | |
49 | int *codes); | |
65671475 | 50 | |
43579403 GH |
51 | InputEvent *qemu_input_event_new_btn(InputButton btn, bool down); |
52 | void qemu_input_queue_btn(QemuConsole *src, InputButton btn, bool down); | |
53 | void qemu_input_update_buttons(QemuConsole *src, uint32_t *button_map, | |
54 | uint32_t button_old, uint32_t button_new); | |
55 | ||
502c8db5 | 56 | bool qemu_input_is_absolute(void); |
43579403 GH |
57 | int qemu_input_scale_axis(int value, int size_in, int size_out); |
58 | InputEvent *qemu_input_event_new_move(InputEventKind kind, | |
59 | InputAxis axis, int value); | |
60 | void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value); | |
61 | void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, | |
62 | int value, int size); | |
63 | ||
4a33f45e GH |
64 | void qemu_input_check_mode_change(void); |
65 | void qemu_add_mouse_mode_change_notifier(Notifier *notify); | |
66 | void qemu_remove_mouse_mode_change_notifier(Notifier *notify); | |
67 | ||
e0d2bd51 GH |
68 | int input_linux_init(void *opaque, QemuOpts *opts, Error **errp); |
69 | ||
c8b405b6 | 70 | #endif /* INPUT_H */ |