2013-11-27 10:35:26 +01:00
|
|
|
#ifndef INPUT_H
|
|
|
|
#define INPUT_H
|
|
|
|
|
2018-02-11 10:36:01 +01:00
|
|
|
#include "qapi/qapi-types-ui.h"
|
2019-08-12 07:23:31 +02:00
|
|
|
#include "qemu/notify.h"
|
2013-11-27 10:35:26 +01: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)
|
2023-05-26 13:29:21 +02:00
|
|
|
#define INPUT_EVENT_MASK_MTT (1<<INPUT_EVENT_KIND_MTT)
|
2013-11-27 10:35:26 +01:00
|
|
|
|
2017-05-05 15:39:52 +02:00
|
|
|
#define INPUT_EVENT_ABS_MIN 0x0000
|
|
|
|
#define INPUT_EVENT_ABS_MAX 0x7FFF
|
2023-05-26 13:29:21 +02:00
|
|
|
#define INPUT_EVENT_SLOTS_MIN 0x0
|
|
|
|
#define INPUT_EVENT_SLOTS_MAX 0xa
|
2013-11-27 18:24:29 +01:00
|
|
|
|
2013-11-27 10:35:26 +01: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 00:38:45 +01:00
|
|
|
void qemu_input_handler_deactivate(QemuInputHandlerState *s);
|
2013-11-27 10:35:26 +01:00
|
|
|
void qemu_input_handler_unregister(QemuInputHandlerState *s);
|
2014-05-19 15:18:37 +02:00
|
|
|
void qemu_input_handler_bind(QemuInputHandlerState *s,
|
|
|
|
const char *device_id, int head,
|
|
|
|
Error **errp);
|
2013-11-27 10:35:26 +01:00
|
|
|
void qemu_input_event_send(QemuConsole *src, InputEvent *evt);
|
2015-09-17 18:25:24 +02:00
|
|
|
void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt);
|
2013-11-27 10:35:26 +01:00
|
|
|
void qemu_input_event_sync(void);
|
2015-09-17 18:25:24 +02:00
|
|
|
void qemu_input_event_sync_impl(void);
|
2013-11-27 10:35:26 +01:00
|
|
|
|
2013-11-27 11:38:47 +01: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 13:02:40 +02:00
|
|
|
void qemu_input_event_send_key_delay(uint32_t delay_ms);
|
2017-09-29 12:11:59 +02:00
|
|
|
int qemu_input_key_number_to_qcode(unsigned int nr);
|
2014-03-11 12:15:39 +01: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 17:29:15 +02:00
|
|
|
int qemu_input_linux_to_qcode(unsigned int lnx);
|
2013-11-27 11:38:47 +01:00
|
|
|
|
2013-11-27 18:24:29 +01: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);
|
|
|
|
|
2023-09-21 10:29:34 +02:00
|
|
|
bool qemu_input_is_absolute(QemuConsole *con);
|
2017-05-05 15:39:52 +02:00
|
|
|
int qemu_input_scale_axis(int value,
|
|
|
|
int min_in, int max_in,
|
|
|
|
int min_out, int max_out);
|
2013-11-27 18:24:29 +01:00
|
|
|
void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value);
|
2017-05-05 15:39:52 +02:00
|
|
|
void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value,
|
|
|
|
int min_in, int max_in);
|
2023-05-26 13:29:24 +02:00
|
|
|
void qemu_input_queue_mtt(QemuConsole *src, InputMultiTouchType type, int slot,
|
|
|
|
int tracking_id);
|
|
|
|
void qemu_input_queue_mtt_abs(QemuConsole *src, InputAxis axis, int value,
|
|
|
|
int min_in, int max_in,
|
|
|
|
int slot, int tracking_id);
|
2013-11-27 18:24:29 +01:00
|
|
|
|
2013-12-05 11:23:42 +01: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-17 17:47:15 +01:00
|
|
|
extern const guint qemu_input_map_atset1_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_atset1_to_qcode[];
|
|
|
|
|
2017-09-29 12:11:59 +02:00
|
|
|
extern const guint qemu_input_map_linux_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_linux_to_qcode[];
|
|
|
|
|
2018-01-17 17:41:15 +01: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-17 17:41:17 +01:00
|
|
|
extern const guint qemu_input_map_qcode_to_linux_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_linux[];
|
|
|
|
|
2017-09-29 12:11:59 +02:00
|
|
|
extern const guint qemu_input_map_qcode_to_qnum_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_qnum[];
|
2018-01-17 17:41:16 +01:00
|
|
|
|
|
|
|
extern const guint qemu_input_map_qcode_to_sun_len;
|
|
|
|
extern const guint16 qemu_input_map_qcode_to_sun[];
|
2017-09-29 12:11:59 +02:00
|
|
|
|
|
|
|
extern const guint qemu_input_map_qnum_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_qnum_to_qcode[];
|
|
|
|
|
2018-01-17 17:47:14 +01:00
|
|
|
extern const guint qemu_input_map_usb_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_usb_to_qcode[];
|
|
|
|
|
2018-01-17 17:47:15 +01: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 01:51:56 +02:00
|
|
|
extern const guint qemu_input_map_osx_to_qcode_len;
|
|
|
|
extern const guint16 qemu_input_map_osx_to_qcode[];
|
|
|
|
|
2013-11-27 10:35:26 +01:00
|
|
|
#endif /* INPUT_H */
|