4 #include "qapi-types.h"
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)
11 #define INPUT_EVENT_ABS_SIZE 0x8000
13 typedef struct QemuInputHandler QemuInputHandler
;
14 typedef struct QemuInputHandlerState QemuInputHandlerState
;
16 typedef void (*QemuInputHandlerEvent
)(DeviceState
*dev
, QemuConsole
*src
,
18 typedef void (*QemuInputHandlerSync
)(DeviceState
*dev
);
20 struct QemuInputHandler
{
23 QemuInputHandlerEvent event
;
24 QemuInputHandlerSync sync
;
27 QemuInputHandlerState
*qemu_input_handler_register(DeviceState
*dev
,
28 QemuInputHandler
*handler
);
29 void qemu_input_handler_activate(QemuInputHandlerState
*s
);
30 void qemu_input_handler_deactivate(QemuInputHandlerState
*s
);
31 void qemu_input_handler_unregister(QemuInputHandlerState
*s
);
32 void qemu_input_handler_bind(QemuInputHandlerState
*s
,
33 const char *device_id
, int head
,
35 void qemu_input_event_send(QemuConsole
*src
, InputEvent
*evt
);
36 void qemu_input_event_sync(void);
38 InputEvent
*qemu_input_event_new_key(KeyValue
*key
, bool down
);
39 void qemu_input_event_send_key(QemuConsole
*src
, KeyValue
*key
, bool down
);
40 void qemu_input_event_send_key_number(QemuConsole
*src
, int num
, bool down
);
41 void qemu_input_event_send_key_qcode(QemuConsole
*src
, QKeyCode q
, bool down
);
42 void qemu_input_event_send_key_delay(uint32_t delay_ms
);
43 int qemu_input_key_number_to_qcode(uint8_t nr
);
44 int qemu_input_key_value_to_number(const KeyValue
*value
);
45 int qemu_input_key_value_to_qcode(const KeyValue
*value
);
46 int qemu_input_key_value_to_scancode(const KeyValue
*value
, bool down
,
49 InputEvent
*qemu_input_event_new_btn(InputButton btn
, bool down
);
50 void qemu_input_queue_btn(QemuConsole
*src
, InputButton btn
, bool down
);
51 void qemu_input_update_buttons(QemuConsole
*src
, uint32_t *button_map
,
52 uint32_t button_old
, uint32_t button_new
);
54 bool qemu_input_is_absolute(void);
55 int qemu_input_scale_axis(int value
, int size_in
, int size_out
);
56 InputEvent
*qemu_input_event_new_move(InputEventKind kind
,
57 InputAxis axis
, int value
);
58 void qemu_input_queue_rel(QemuConsole
*src
, InputAxis axis
, int value
);
59 void qemu_input_queue_abs(QemuConsole
*src
, InputAxis axis
,
62 void qemu_input_check_mode_change(void);
63 void qemu_add_mouse_mode_change_notifier(Notifier
*notify
);
64 void qemu_remove_mouse_mode_change_notifier(Notifier
*notify
);