]>
Commit | Line | Data |
---|---|---|
c8b405b6 GH |
1 | #ifndef INPUT_H |
2 | #define INPUT_H | |
3 | ||
9af23989 | 4 | #include "qapi/qapi-types-ui.h" |
c8b405b6 GH |
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 | ||
9cfa7ab9 PV |
11 | #define INPUT_EVENT_ABS_MIN 0x0000 |
12 | #define INPUT_EVENT_ABS_MAX 0x7FFF | |
43579403 | 13 | |
c8b405b6 GH |
14 | typedef struct QemuInputHandler QemuInputHandler; |
15 | typedef struct QemuInputHandlerState QemuInputHandlerState; | |
16 | ||
17 | typedef void (*QemuInputHandlerEvent)(DeviceState *dev, QemuConsole *src, | |
18 | InputEvent *evt); | |
19 | typedef void (*QemuInputHandlerSync)(DeviceState *dev); | |
20 | ||
21 | struct QemuInputHandler { | |
22 | const char *name; | |
23 | uint32_t mask; | |
24 | QemuInputHandlerEvent event; | |
25 | QemuInputHandlerSync sync; | |
26 | }; | |
27 | ||
28 | QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev, | |
29 | QemuInputHandler *handler); | |
30 | void qemu_input_handler_activate(QemuInputHandlerState *s); | |
528728fd | 31 | void qemu_input_handler_deactivate(QemuInputHandlerState *s); |
c8b405b6 | 32 | void qemu_input_handler_unregister(QemuInputHandlerState *s); |
6f5943cf GH |
33 | void qemu_input_handler_bind(QemuInputHandlerState *s, |
34 | const char *device_id, int head, | |
35 | Error **errp); | |
c8b405b6 | 36 | void qemu_input_event_send(QemuConsole *src, InputEvent *evt); |
ee312992 | 37 | void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt); |
c8b405b6 | 38 | void qemu_input_event_sync(void); |
ee312992 | 39 | void qemu_input_event_sync_impl(void); |
c8b405b6 | 40 | |
65671475 GH |
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); |
bcd5ac9b | 45 | int qemu_input_key_number_to_qcode(unsigned int 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); | |
606eb0c6 | 50 | int qemu_input_linux_to_qcode(unsigned int lnx); |
65671475 | 51 | |
43579403 GH |
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); |
9cfa7ab9 PV |
57 | int qemu_input_scale_axis(int value, |
58 | int min_in, int max_in, | |
59 | int min_out, int max_out); | |
43579403 | 60 | void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value); |
9cfa7ab9 PV |
61 | void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value, |
62 | int min_in, int max_in); | |
43579403 | 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 | ||
2ec78706 DB |
68 | extern const guint qemu_input_map_atset1_to_qcode_len; |
69 | extern const guint16 qemu_input_map_atset1_to_qcode[]; | |
70 | ||
bcd5ac9b DB |
71 | extern const guint qemu_input_map_linux_to_qcode_len; |
72 | extern const guint16 qemu_input_map_linux_to_qcode[]; | |
73 | ||
ab8f9d49 DB |
74 | extern const guint qemu_input_map_qcode_to_atset1_len; |
75 | extern const guint16 qemu_input_map_qcode_to_atset1[]; | |
76 | ||
77 | extern const guint qemu_input_map_qcode_to_atset2_len; | |
78 | extern const guint16 qemu_input_map_qcode_to_atset2[]; | |
79 | ||
80 | extern const guint qemu_input_map_qcode_to_atset3_len; | |
81 | extern const guint16 qemu_input_map_qcode_to_atset3[]; | |
82 | ||
5a15e6b1 DB |
83 | extern const guint qemu_input_map_qcode_to_linux_len; |
84 | extern const guint16 qemu_input_map_qcode_to_linux[]; | |
85 | ||
bcd5ac9b DB |
86 | extern const guint qemu_input_map_qcode_to_qnum_len; |
87 | extern const guint16 qemu_input_map_qcode_to_qnum[]; | |
e709a61a DB |
88 | |
89 | extern const guint qemu_input_map_qcode_to_sun_len; | |
90 | extern const guint16 qemu_input_map_qcode_to_sun[]; | |
bcd5ac9b DB |
91 | |
92 | extern const guint qemu_input_map_qnum_to_qcode_len; | |
93 | extern const guint16 qemu_input_map_qnum_to_qcode[]; | |
94 | ||
ed7b2624 DB |
95 | extern const guint qemu_input_map_usb_to_qcode_len; |
96 | extern const guint16 qemu_input_map_usb_to_qcode[]; | |
97 | ||
2ec78706 DB |
98 | extern const guint qemu_input_map_win32_to_qcode_len; |
99 | extern const guint16 qemu_input_map_win32_to_qcode[]; | |
100 | ||
101 | extern const guint qemu_input_map_x11_to_qcode_len; | |
102 | extern const guint16 qemu_input_map_x11_to_qcode[]; | |
103 | ||
104 | extern const guint qemu_input_map_xorgevdev_to_qcode_len; | |
105 | extern const guint16 qemu_input_map_xorgevdev_to_qcode[]; | |
106 | ||
107 | extern const guint qemu_input_map_xorgkbd_to_qcode_len; | |
108 | extern const guint16 qemu_input_map_xorgkbd_to_qcode[]; | |
109 | ||
110 | extern const guint qemu_input_map_xorgxquartz_to_qcode_len; | |
111 | extern const guint16 qemu_input_map_xorgxquartz_to_qcode[]; | |
112 | ||
113 | extern const guint qemu_input_map_xorgxwin_to_qcode_len; | |
114 | extern const guint16 qemu_input_map_xorgxwin_to_qcode[]; | |
115 | ||
656282d2 KF |
116 | extern const guint qemu_input_map_osx_to_qcode_len; |
117 | extern const guint16 qemu_input_map_osx_to_qcode[]; | |
118 | ||
c8b405b6 | 119 | #endif /* INPUT_H */ |