4 #include "qapi/qapi-types-ui.h"
5 #include "qemu/notify.h"
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 #define INPUT_EVENT_MASK_MTT (1<<INPUT_EVENT_KIND_MTT)
13 #define INPUT_EVENT_ABS_MIN 0x0000
14 #define INPUT_EVENT_ABS_MAX 0x7FFF
15 #define INPUT_EVENT_SLOTS_MIN 0x0
16 #define INPUT_EVENT_SLOTS_MAX 0xa
18 typedef struct QemuInputHandler QemuInputHandler
;
19 typedef struct QemuInputHandlerState QemuInputHandlerState
;
21 typedef void (*QemuInputHandlerEvent
)(DeviceState
*dev
, QemuConsole
*src
,
23 typedef void (*QemuInputHandlerSync
)(DeviceState
*dev
);
25 struct QemuInputHandler
{
28 QemuInputHandlerEvent event
;
29 QemuInputHandlerSync sync
;
32 QemuInputHandlerState
*qemu_input_handler_register(DeviceState
*dev
,
33 const QemuInputHandler
*handler
);
34 void qemu_input_handler_activate(QemuInputHandlerState
*s
);
35 void qemu_input_handler_deactivate(QemuInputHandlerState
*s
);
36 void qemu_input_handler_unregister(QemuInputHandlerState
*s
);
37 void qemu_input_handler_bind(QemuInputHandlerState
*s
,
38 const char *device_id
, int head
,
40 void qemu_input_event_send(QemuConsole
*src
, InputEvent
*evt
);
41 void qemu_input_event_send_impl(QemuConsole
*src
, InputEvent
*evt
);
42 void qemu_input_event_sync(void);
43 void qemu_input_event_sync_impl(void);
45 void qemu_input_event_send_key(QemuConsole
*src
, KeyValue
*key
, bool down
);
46 void qemu_input_event_send_key_number(QemuConsole
*src
, int num
, bool down
);
47 void qemu_input_event_send_key_qcode(QemuConsole
*src
, QKeyCode q
, bool down
);
48 void qemu_input_event_send_key_delay(uint32_t delay_ms
);
49 int qemu_input_key_number_to_qcode(unsigned int nr
);
50 int qemu_input_key_value_to_number(const KeyValue
*value
);
51 int qemu_input_key_value_to_qcode(const KeyValue
*value
);
52 int qemu_input_key_value_to_scancode(const KeyValue
*value
, bool down
,
54 int qemu_input_linux_to_qcode(unsigned int lnx
);
56 void qemu_input_queue_btn(QemuConsole
*src
, InputButton btn
, bool down
);
57 void qemu_input_update_buttons(QemuConsole
*src
, uint32_t *button_map
,
58 uint32_t button_old
, uint32_t button_new
);
60 bool qemu_input_is_absolute(QemuConsole
*con
);
61 int qemu_input_scale_axis(int value
,
62 int min_in
, int max_in
,
63 int min_out
, int max_out
);
64 void qemu_input_queue_rel(QemuConsole
*src
, InputAxis axis
, int value
);
65 void qemu_input_queue_abs(QemuConsole
*src
, InputAxis axis
, int value
,
66 int min_in
, int max_in
);
67 void qemu_input_queue_mtt(QemuConsole
*src
, InputMultiTouchType type
, int slot
,
69 void qemu_input_queue_mtt_abs(QemuConsole
*src
, InputAxis axis
, int value
,
70 int min_in
, int max_in
,
71 int slot
, int tracking_id
);
73 void qemu_input_check_mode_change(void);
74 void qemu_add_mouse_mode_change_notifier(Notifier
*notify
);
75 void qemu_remove_mouse_mode_change_notifier(Notifier
*notify
);
77 extern const guint qemu_input_map_atset1_to_qcode_len
;
78 extern const guint16 qemu_input_map_atset1_to_qcode
[];
80 extern const guint qemu_input_map_linux_to_qcode_len
;
81 extern const guint16 qemu_input_map_linux_to_qcode
[];
83 extern const guint qemu_input_map_qcode_to_atset1_len
;
84 extern const guint16 qemu_input_map_qcode_to_atset1
[];
86 extern const guint qemu_input_map_qcode_to_atset2_len
;
87 extern const guint16 qemu_input_map_qcode_to_atset2
[];
89 extern const guint qemu_input_map_qcode_to_atset3_len
;
90 extern const guint16 qemu_input_map_qcode_to_atset3
[];
92 extern const guint qemu_input_map_qcode_to_linux_len
;
93 extern const guint16 qemu_input_map_qcode_to_linux
[];
95 extern const guint qemu_input_map_qcode_to_qnum_len
;
96 extern const guint16 qemu_input_map_qcode_to_qnum
[];
98 extern const guint qemu_input_map_qcode_to_sun_len
;
99 extern const guint16 qemu_input_map_qcode_to_sun
[];
101 extern const guint qemu_input_map_qnum_to_qcode_len
;
102 extern const guint16 qemu_input_map_qnum_to_qcode
[];
104 extern const guint qemu_input_map_usb_to_qcode_len
;
105 extern const guint16 qemu_input_map_usb_to_qcode
[];
107 extern const guint qemu_input_map_win32_to_qcode_len
;
108 extern const guint16 qemu_input_map_win32_to_qcode
[];
110 extern const guint qemu_input_map_x11_to_qcode_len
;
111 extern const guint16 qemu_input_map_x11_to_qcode
[];
113 extern const guint qemu_input_map_xorgevdev_to_qcode_len
;
114 extern const guint16 qemu_input_map_xorgevdev_to_qcode
[];
116 extern const guint qemu_input_map_xorgkbd_to_qcode_len
;
117 extern const guint16 qemu_input_map_xorgkbd_to_qcode
[];
119 extern const guint qemu_input_map_xorgxquartz_to_qcode_len
;
120 extern const guint16 qemu_input_map_xorgxquartz_to_qcode
[];
122 extern const guint qemu_input_map_xorgxwin_to_qcode_len
;
123 extern const guint16 qemu_input_map_xorgxwin_to_qcode
[];
125 extern const guint qemu_input_map_osx_to_qcode_len
;
126 extern const guint16 qemu_input_map_osx_to_qcode
[];