Replace the qcode_to_keycode_set1, qcode_to_keycode_set2, and qcode_to_keycode_set3 tables with automatically generated tables. Missing entries in qcode_to_keycode_set1 now fixed: - Q_KEY_CODE_SYSRQ -> 0x54 - Q_KEY_CODE_PRINT -> 0x54 (NB ignored due to special case) - Q_KEY_CODE_AGAIN -> 0xe005 - Q_KEY_CODE_PROPS -> 0xe006 - Q_KEY_CODE_UNDO -> 0xe007 - Q_KEY_CODE_FRONT -> 0xe00c - Q_KEY_CODE_COPY -> 0xe078 - Q_KEY_CODE_OPEN -> 0x64 - Q_KEY_CODE_PASTE -> 0x65 - Q_KEY_CODE_CUT -> 0xe03c - Q_KEY_CODE_LF -> 0x5b - Q_KEY_CODE_HELP -> 0xe075 - Q_KEY_CODE_COMPOSE -> 0xe05d - Q_KEY_CODE_PAUSE -> 0xe046 - Q_KEY_CODE_KP_EQUALS -> 0x59 And some mistakes corrected: - Q_KEY_CODE_HIRAGANA was mapped to 0x70 (Katakanahiragana) instead of of 0x77 (Hirigana) - Q_KEY_CODE_MENU was incorrectly mapped to the compose scancode (0xe05d) and is now mapped to 0xe01e - Q_KEY_CODE_FIND was mapped to 0xe065 (Search) instead of to 0xe041 (Find) - Q_KEY_CODE_POWER, SLEEP & WAKE had 0x0e instead of 0xe0 as the prefix Missing entries in qcode_to_keycode_set2 now fixed: - Q_KEY_CODE_PRINT -> 0x7f (NB ignored due to special case) - Q_KEY_CODE_COMPOSE -> 0xe02f - Q_KEY_CODE_PAUSE -> 0xe077 - Q_KEY_CODE_KP_EQUALS -> 0x0f And some mistakes corrected: - Q_KEY_CODE_HIRAGANA was mapped to 0x13 (Katakanahiragana) instead of of 0x62 (Hirigana) - Q_KEY_CODE_MENU was incorrectly mapped to the compose scancode (0xe02f) and is now not mapped - Q_KEY_CODE_FIND was mapped to 0xe010 (Search) and is now not mapped. - Q_KEY_CODE_POWER, SLEEP & WAKE had 0x0e instead of 0xe0 as the prefix Missing entries in qcode_to_keycode_set3 now fixed: - Q_KEY_CODE_ASTERISK -> 0x7e - Q_KEY_CODE_SYSRQ -> 0x57 - Q_KEY_CODE_LESS -> 0x13 - Q_KEY_CODE_STOP -> 0x0a - Q_KEY_CODE_AGAIN -> 0x0b - Q_KEY_CODE_PROPS -> 0x0c - Q_KEY_CODE_UNDO -> 0x10 - Q_KEY_CODE_COPY -> 0x18 - Q_KEY_CODE_OPEN -> 0x20 - Q_KEY_CODE_PASTE -> 0x28 - Q_KEY_CODE_FIND -> 0x30 - Q_KEY_CODE_CUT -> 0x38 - Q_KEY_CODE_HELP -> 0x09 - Q_KEY_CODE_COMPOSE -> 0x8d - Q_KEY_CODE_AUDIONEXT -> 0x93 - Q_KEY_CODE_AUDIOPREV -> 0x94 - Q_KEY_CODE_AUDIOSTOP -> 0x98 - Q_KEY_CODE_AUDIOMUTE -> 0x9c - Q_KEY_CODE_VOLUMEUP -> 0x95 - Q_KEY_CODE_VOLUMEDOWN -> 0x9d - Q_KEY_CODE_CALCULATOR -> 0xa3 - Q_KEY_CODE_AC_HOME -> 0x97 And some mistakes corrected: - Q_KEY_CODE_MENU was incorrectly mapped to the compose scancode (0x8d) and is now 0x91 Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20180117164118.8510-2-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
117 lines
4.7 KiB
C
117 lines
4.7 KiB
C
#ifndef INPUT_H
|
|
#define INPUT_H
|
|
|
|
#include "qapi-types.h"
|
|
|
|
#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)
|
|
|
|
#define INPUT_EVENT_ABS_MIN 0x0000
|
|
#define INPUT_EVENT_ABS_MAX 0x7FFF
|
|
|
|
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);
|
|
void qemu_input_handler_deactivate(QemuInputHandlerState *s);
|
|
void qemu_input_handler_unregister(QemuInputHandlerState *s);
|
|
void qemu_input_handler_bind(QemuInputHandlerState *s,
|
|
const char *device_id, int head,
|
|
Error **errp);
|
|
void qemu_input_event_send(QemuConsole *src, InputEvent *evt);
|
|
void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt);
|
|
void qemu_input_event_sync(void);
|
|
void qemu_input_event_sync_impl(void);
|
|
|
|
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);
|
|
void qemu_input_event_send_key_delay(uint32_t delay_ms);
|
|
int qemu_input_key_number_to_qcode(unsigned int nr);
|
|
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);
|
|
int qemu_input_linux_to_qcode(unsigned int lnx);
|
|
|
|
InputEvent *qemu_input_event_new_btn(InputButton btn, bool down);
|
|
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);
|
|
|
|
bool qemu_input_is_absolute(void);
|
|
int qemu_input_scale_axis(int value,
|
|
int min_in, int max_in,
|
|
int min_out, int max_out);
|
|
InputEvent *qemu_input_event_new_move(InputEventKind kind,
|
|
InputAxis axis, int value);
|
|
void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value);
|
|
void qemu_input_queue_abs(QemuConsole *src, InputAxis axis, int value,
|
|
int min_in, int max_in);
|
|
|
|
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);
|
|
|
|
extern const guint qemu_input_map_atset1_to_qcode_len;
|
|
extern const guint16 qemu_input_map_atset1_to_qcode[];
|
|
|
|
extern const guint qemu_input_map_linux_to_qcode_len;
|
|
extern const guint16 qemu_input_map_linux_to_qcode[];
|
|
|
|
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[];
|
|
|
|
extern const guint qemu_input_map_qcode_to_qnum_len;
|
|
extern const guint16 qemu_input_map_qcode_to_qnum[];
|
|
|
|
extern const guint qemu_input_map_qnum_to_qcode_len;
|
|
extern const guint16 qemu_input_map_qnum_to_qcode[];
|
|
|
|
extern const guint qemu_input_map_qcode_to_linux_len;
|
|
extern const guint16 qemu_input_map_qcode_to_linux[];
|
|
|
|
extern const guint qemu_input_map_usb_to_qcode_len;
|
|
extern const guint16 qemu_input_map_usb_to_qcode[];
|
|
|
|
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[];
|
|
|
|
#endif /* INPUT_H */
|