1 #ifndef INPUT_H 2 #define INPUT_H 3 4 #include "qapi/qapi-types-ui.h" 5 #include "qemu/notify.h" 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 #define INPUT_EVENT_MASK_MTT (1<<INPUT_EVENT_KIND_MTT) 12 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 17 18 typedef struct QemuInputHandler QemuInputHandler; 19 typedef struct QemuInputHandlerState QemuInputHandlerState; 20 21 typedef void (*QemuInputHandlerEvent)(DeviceState *dev, QemuConsole *src, 22 InputEvent *evt); 23 typedef void (*QemuInputHandlerSync)(DeviceState *dev); 24 25 struct QemuInputHandler { 26 const char *name; 27 uint32_t mask; 28 QemuInputHandlerEvent event; 29 QemuInputHandlerSync sync; 30 }; 31 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, 39 Error **errp); 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); 44 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, 53 int *codes); 54 int qemu_input_linux_to_qcode(unsigned int lnx); 55 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); 59 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, 68 int tracking_id); 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); 72 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); 76 77 extern const guint qemu_input_map_atset1_to_qcode_len; 78 extern const guint16 qemu_input_map_atset1_to_qcode[]; 79 80 extern const guint qemu_input_map_linux_to_qcode_len; 81 extern const guint16 qemu_input_map_linux_to_qcode[]; 82 83 extern const guint qemu_input_map_qcode_to_atset1_len; 84 extern const guint16 qemu_input_map_qcode_to_atset1[]; 85 86 extern const guint qemu_input_map_qcode_to_atset2_len; 87 extern const guint16 qemu_input_map_qcode_to_atset2[]; 88 89 extern const guint qemu_input_map_qcode_to_atset3_len; 90 extern const guint16 qemu_input_map_qcode_to_atset3[]; 91 92 extern const guint qemu_input_map_qcode_to_linux_len; 93 extern const guint16 qemu_input_map_qcode_to_linux[]; 94 95 extern const guint qemu_input_map_qcode_to_qnum_len; 96 extern const guint16 qemu_input_map_qcode_to_qnum[]; 97 98 extern const guint qemu_input_map_qcode_to_sun_len; 99 extern const guint16 qemu_input_map_qcode_to_sun[]; 100 101 extern const guint qemu_input_map_qnum_to_qcode_len; 102 extern const guint16 qemu_input_map_qnum_to_qcode[]; 103 104 extern const guint qemu_input_map_usb_to_qcode_len; 105 extern const guint16 qemu_input_map_usb_to_qcode[]; 106 107 extern const guint qemu_input_map_win32_to_qcode_len; 108 extern const guint16 qemu_input_map_win32_to_qcode[]; 109 110 extern const guint qemu_input_map_x11_to_qcode_len; 111 extern const guint16 qemu_input_map_x11_to_qcode[]; 112 113 extern const guint qemu_input_map_xorgevdev_to_qcode_len; 114 extern const guint16 qemu_input_map_xorgevdev_to_qcode[]; 115 116 extern const guint qemu_input_map_xorgkbd_to_qcode_len; 117 extern const guint16 qemu_input_map_xorgkbd_to_qcode[]; 118 119 extern const guint qemu_input_map_xorgxquartz_to_qcode_len; 120 extern const guint16 qemu_input_map_xorgxquartz_to_qcode[]; 121 122 extern const guint qemu_input_map_xorgxwin_to_qcode_len; 123 extern const guint16 qemu_input_map_xorgxwin_to_qcode[]; 124 125 extern const guint qemu_input_map_osx_to_qcode_len; 126 extern const guint16 qemu_input_map_osx_to_qcode[]; 127 128 #endif /* INPUT_H */ 129