6567147588
A bunch of helper functions to manage keyboard events, to make life simpler for the ui code when submitting keyboard events. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
38 lines
1.4 KiB
C
38 lines
1.4 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)
|
|
|
|
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_unregister(QemuInputHandlerState *s);
|
|
void qemu_input_event_send(QemuConsole *src, InputEvent *evt);
|
|
void qemu_input_event_sync(void);
|
|
|
|
InputEvent *qemu_input_event_new_key(KeyValue *key, bool down);
|
|
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);
|
|
|
|
#endif /* INPUT_H */
|