2013-11-27 17:35:26 +08:00
|
|
|
#ifndef INPUT_H
|
|
|
|
#define INPUT_H
|
|
|
|
|
2018-02-11 17:36:01 +08:00
|
|
|
#include "qapi/qapi-types-ui.h"
|
2019-08-12 13:23:31 +08:00
|
|
|
#include "qemu/notify.h"
|
2013-11-27 17:35:26 +08:00
|
|
|
|
|
|
|
#define INPUT_EVENT_MASK_KEY (1<<INPUT_EVENT_KIND_KEY)
|
|
|
|
#define INPUT_EVENT_MASK_BTN (1<<INPUT_EVENT_KIND_BTN)
|
|
|
|
#define INPUT_EVENT_MASK_REL (1<<INPUT_EVENT_KIND_REL)
|
|
|
|
#define INPUT_EVENT_MASK_ABS (1<<INPUT_EVENT_KIND_ABS)
|
|
|
|
|
2017-05-05 21:39:52 +08:00
|
|
|
#define INPUT_EVENT_ABS_MIN 0x0000
|
|
|
|
#define INPUT_EVENT_ABS_MAX 0x7FFF
|
2013-11-28 01:24:29 +08:00
|
|
|
|
2013-11-27 17:35:26 +08:00
|
|
|
typedef struct QemuInputHandler QemuInputHandler;
|
|
|
|
typedef struct QemuInputHandlerState QemuInputHandlerState;
|
|
|
|
|
|
|
|
typedef void (*QemuInputHandlerEvent)(DeviceState *dev, QemuConsole *src,
|
|
|
|
InputEvent *evt);
|
|
|
|
typedef void (*QemuInputHandlerSync)(DeviceState *dev);
|
|
|
|
|
|
|
|
struct QemuInputHandler {
|
|
|
|
const char *name;
|
|
|
|
uint32_t mask;
|
|
|
|
QemuInputHandlerEvent event;
|
|
|
|
QemuInputHandlerSync sync;
|
|
|
|
};
|
|
|
|
|
|
|
|
QemuInputHandlerState *qemu_input_handler_register(DeviceState *dev,
|
|
|
|
QemuInputHandler *handler);
|
|
|
|
void qemu_input_handler_activate(QemuInputHandlerState *s);
|
2014-03-16 07:38:45 +08:00
|
|
|
void qemu_input_handler_deactivate(QemuInputHandlerState *s);
|
2013-11-27 17:35:26 +08:00
|
|
|
void qemu_input_handler_unregister(QemuInputHandlerState *s);
|
2014-05-19 21:18:37 +08:00
|
|
|
void qemu_input_handler_bind(QemuInputHandlerState *s,
|
|
|
|
const char *device_id, int head,
|
|
|
|
Error **errp);
|
2013-11-27 17:35:26 +08:00
|
|
|
void qemu_input_event_send(QemuConsole *src, InputEvent *evt);
|
2015-09-18 00:25:24 +08:00
|
|
|
void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt);
|
2013-11-27 17:35:26 +08:00
|
|
|
void qemu_input_event_sync(void);
|
2015-09-18 00:25:24 +08:00
|
|
|
void qemu_input_event_sync_impl(void);
|
2013-11-27 17:35:26 +08:00
|
|
|
|
2013-11-27 18:38:47 +08:00
|
|
|
void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down);
|
|
|
|
void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down);
|
|
|
|
void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down);
|
2014-05-28 19:02:40 +08:00
|
|
|
void qemu_input_event_send_key_delay(uint32_t delay_ms);
|
2017-09-29 18:11:59 +08:00
|
|
|
int qemu_input_key_number_to_qcode(unsigned int nr);
|
2014-03-11 19:15:39 +08:00
|
|
|
int qemu_input_key_value_to_number(const KeyValue *value);
|
|
|
|
int qemu_input_key_value_to_qcode(const KeyValue *value);
|
|
|
|
int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,
|
|
|
|
int *codes);
|
2017-07-26 23:29:15 +08:00
|
|
|
int qemu_input_linux_to_qcode(unsigned int lnx);
|
2013-11-27 18:38:47 +08:00
|
|
|
|
2013-11-28 01:24:29 +08:00
|
|
|
void qemu_input_queue_btn(QemuConsole *src, InputButton btn, bool down);
|
|
|
|
void qemu_input_update_buttons(QemuConsole *src, uint32_t *button_map,
|
|
|
|
uint32_t button_old, uint32_t button_new);
|
|
|
|
|
2013-11-28 18:31:09 +08:00
|
|
|
bool qemu_input_is_absolute(void);
|
2017-05-05 21:39:52 +08:00
|
|
|
int qemu_input_scale_axis(int value,
|
|
|
|
int min_in, int max_in,
|
|
|
|
int min_out, int max_out);
|
2013-11-28 01:24:29 +08:00
|
|
|
void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value);
|
2017-05-05 21:39:52 +08:00
|
|
|
void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value,
|
|
|
|
int min_in, int max_in);
|
2013-11-28 01:24:29 +08:00
|
|
|
|
2013-12-05 18:23:42 +08:00
|
|
|
void qemu_input_check_mode_change(void);
|
|
|
|
void qemu_add_mouse_mode_change_notifier(Notifier *notify);
|
|
|
|
void qemu_remove_mouse_mode_change_notifier(Notifier *notify);
|
|
|
|
|
2018-01-18 00:47:15 +08:00
|
|
|
extern const guint qemu_input_map_atset1_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_atset1_to_qcode[];
|
|
|
|
|
2017-09-29 18:11:59 +08:00
|
|
|
extern const guint qemu_input_map_linux_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_linux_to_qcode[];
|
|
|
|
|
2018-01-18 00:41:15 +08:00
|
|
|
extern const guint qemu_input_map_qcode_to_atset1_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_atset1[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_qcode_to_atset2_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_atset2[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_qcode_to_atset3_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_atset3[];
|
|
|
|
|
2018-01-18 00:41:17 +08:00
|
|
|
extern const guint qemu_input_map_qcode_to_linux_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_linux[];
|
|
|
|
|
2017-09-29 18:11:59 +08:00
|
|
|
extern const guint qemu_input_map_qcode_to_qnum_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_qnum[];
|
2018-01-18 00:41:16 +08:00
|
|
|
|
|
|
|
extern const guint qemu_input_map_qcode_to_sun_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_sun[];
|
2017-09-29 18:11:59 +08:00
|
|
|
|
|
|
|
extern const guint qemu_input_map_qnum_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_qnum_to_qcode[];
|
|
|
|
|
2018-01-18 00:47:14 +08:00
|
|
|
extern const guint qemu_input_map_usb_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_usb_to_qcode[];
|
|
|
|
|
2018-01-18 00:47:15 +08:00
|
|
|
extern const guint qemu_input_map_win32_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_win32_to_qcode[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_x11_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_x11_to_qcode[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_xorgevdev_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_xorgevdev_to_qcode[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_xorgkbd_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_xorgkbd_to_qcode[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_xorgxquartz_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_xorgxquartz_to_qcode[];
|
|
|
|
|
|
|
|
extern const guint qemu_input_map_xorgxwin_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_xorgxwin_to_qcode[];
|
|
|
|
|
2018-06-14 07:51:56 +08:00
|
|
|
extern const guint qemu_input_map_osx_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_osx_to_qcode[];
|
|
|
|
|
2013-11-27 17:35:26 +08:00
|
|
|
#endif /* INPUT_H */
|