]>
Commit | Line | Data |
---|---|---|
c8b405b6 GH |
1 | #ifndef INPUT_H |
2 | #define INPUT_H | |
3 | ||
9af23989 | 4 | #include "qapi/qapi-types-ui.h" |
ec150c7e | 5 | #include "qemu/notify.h" |
c8b405b6 GH |
6 | |
7 | #define INPUT_EVENT_MASK_KEY (1<<INPUT_EVENT_KIND_KEY) | |
8 | #define INPUT_EVENT_MASK_BTN (1<<INPUT_EVENT_KIND_BTN) | |
9 | #define INPUT_EVENT_MASK_REL (1<<INPUT_EVENT_KIND_REL) | |
10 | #define INPUT_EVENT_MASK_ABS (1<<INPUT_EVENT_KIND_ABS) | |
11 | ||
9cfa7ab9 PV |
12 | #define INPUT_EVENT_ABS_MIN 0x0000 |
13 | #define INPUT_EVENT_ABS_MAX 0x7FFF | |
43579403 | 14 | |
c8b405b6 GH |
15 | typedef struct QemuInputHandler QemuInputHandler; |
16 | typedef struct QemuInputHandlerState QemuInputHandlerState; | |
17 | ||
18 | typedef void (*QemuInputHandlerEvent)(DeviceState *dev, QemuConsole *src, | |
19 | InputEvent *evt); | |
20 | typedef void (*QemuInputHandlerSync)(DeviceState *dev); | |
21 | ||
22 | struct QemuInputHandler { | |
23 | const char *name; | |
24 | uint32_t mask; | |
25 | QemuInputHandlerEvent event; | |
26 | QemuInputHandlerSync sync; | |
27 | }; | |
28 | ||
29 | QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev, | |
30 | QemuInputHandler *handler); | |
31 | void qemu_input_handler_activate(QemuInputHandlerState *s); | |
528728fd | 32 | void qemu_input_handler_deactivate(QemuInputHandlerState *s); |
c8b405b6 | 33 | void qemu_input_handler_unregister(QemuInputHandlerState *s); |
6f5943cf GH |
34 | void qemu_input_handler_bind(QemuInputHandlerState *s, |
35 | const char *device_id, int head, | |
36 | Error **errp); | |
c8b405b6 | 37 | void qemu_input_event_send(QemuConsole *src, InputEvent *evt); |
ee312992 | 38 | void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt); |
c8b405b6 | 39 | void qemu_input_event_sync(void); |
ee312992 | 40 | void qemu_input_event_sync_impl(void); |
c8b405b6 | 41 | |
65671475 GH |
42 | void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down); |
43 | void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down); | |
44 | void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down); | |
be1a7176 | 45 | void qemu_input_event_send_key_delay(uint32_t delay_ms); |
bcd5ac9b | 46 | int qemu_input_key_number_to_qcode(unsigned int nr); |
02aa76c2 GH |
47 | int qemu_input_key_value_to_number(const KeyValue *value); |
48 | int qemu_input_key_value_to_qcode(const KeyValue *value); | |
49 | int qemu_input_key_value_to_scancode(const KeyValue *value, bool down, | |
50 | int *codes); | |
606eb0c6 | 51 | int qemu_input_linux_to_qcode(unsigned int lnx); |
65671475 | 52 | |
43579403 GH |
53 | void qemu_input_queue_btn(QemuConsole *src, InputButton btn, bool down); |
54 | void qemu_input_update_buttons(QemuConsole *src, uint32_t *button_map, | |
55 | uint32_t button_old, uint32_t button_new); | |
56 | ||
502c8db5 | 57 | bool qemu_input_is_absolute(void); |
9cfa7ab9 PV |
58 | int qemu_input_scale_axis(int value, |
59 | int min_in, int max_in, | |
60 | int min_out, int max_out); | |
43579403 | 61 | void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value); |
9cfa7ab9 PV |
62 | void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value, |
63 | int min_in, int max_in); | |
43579403 | 64 | |
4a33f45e GH |
65 | void qemu_input_check_mode_change(void); |
66 | void qemu_add_mouse_mode_change_notifier(Notifier *notify); | |
67 | void qemu_remove_mouse_mode_change_notifier(Notifier *notify); | |
68 | ||
2ec78706 DB |
69 | extern const guint qemu_input_map_atset1_to_qcode_len; |
70 | extern const guint16 qemu_input_map_atset1_to_qcode[]; | |
71 | ||
bcd5ac9b DB |
72 | extern const guint qemu_input_map_linux_to_qcode_len; |
73 | extern const guint16 qemu_input_map_linux_to_qcode[]; | |
74 | ||
ab8f9d49 DB |
75 | extern const guint qemu_input_map_qcode_to_atset1_len; |
76 | extern const guint16 qemu_input_map_qcode_to_atset1[]; | |
77 | ||
78 | extern const guint qemu_input_map_qcode_to_atset2_len; | |
79 | extern const guint16 qemu_input_map_qcode_to_atset2[]; | |
80 | ||
81 | extern const guint qemu_input_map_qcode_to_atset3_len; | |
82 | extern const guint16 qemu_input_map_qcode_to_atset3[]; | |
83 | ||
5a15e6b1 DB |
84 | extern const guint qemu_input_map_qcode_to_linux_len; |
85 | extern const guint16 qemu_input_map_qcode_to_linux[]; | |
86 | ||
bcd5ac9b DB |
87 | extern const guint qemu_input_map_qcode_to_qnum_len; |
88 | extern const guint16 qemu_input_map_qcode_to_qnum[]; | |
e709a61a DB |
89 | |
90 | extern const guint qemu_input_map_qcode_to_sun_len; | |
91 | extern const guint16 qemu_input_map_qcode_to_sun[]; | |
bcd5ac9b DB |
92 | |
93 | extern const guint qemu_input_map_qnum_to_qcode_len; | |
94 | extern const guint16 qemu_input_map_qnum_to_qcode[]; | |
95 | ||
ed7b2624 DB |
96 | extern const guint qemu_input_map_usb_to_qcode_len; |
97 | extern const guint16 qemu_input_map_usb_to_qcode[]; | |
98 | ||
2ec78706 DB |
99 | extern const guint qemu_input_map_win32_to_qcode_len; |
100 | extern const guint16 qemu_input_map_win32_to_qcode[]; | |
101 | ||
102 | extern const guint qemu_input_map_x11_to_qcode_len; | |
103 | extern const guint16 qemu_input_map_x11_to_qcode[]; | |
104 | ||
105 | extern const guint qemu_input_map_xorgevdev_to_qcode_len; | |
106 | extern const guint16 qemu_input_map_xorgevdev_to_qcode[]; | |
107 | ||
108 | extern const guint qemu_input_map_xorgkbd_to_qcode_len; | |
109 | extern const guint16 qemu_input_map_xorgkbd_to_qcode[]; | |
110 | ||
111 | extern const guint qemu_input_map_xorgxquartz_to_qcode_len; | |
112 | extern const guint16 qemu_input_map_xorgxquartz_to_qcode[]; | |
113 | ||
114 | extern const guint qemu_input_map_xorgxwin_to_qcode_len; | |
115 | extern const guint16 qemu_input_map_xorgxwin_to_qcode[]; | |
116 | ||
656282d2 KF |
117 | extern const guint qemu_input_map_osx_to_qcode_len; |
118 | extern const guint16 qemu_input_map_osx_to_qcode[]; | |
119 | ||
c8b405b6 | 120 | #endif /* INPUT_H */ |