Wayland键盘消息
void keyboard_keymap(LPVOID data, HKEYBOARD wl_keyboard, uint32_t format, int32_t fd, uint32_t size)
{
}
void keyboard_enter(LPVOID data, HKEYBOARD wl_keyboard, uint32_t serial, HSURFACE surface, struct wl_array *keys)
{
printf("keyboard focus.\n");
}
void keyboard_leave(void *data, HKEYBOARD wl_keyboard, uint32_t serial, HSURFACE surface)
{
}
void keyboard_key(void *data, HKEYBOARD wl_keyboard,
uint32_t serial,
uint32_t time,
uint32_t key,
uint32_t state)
{
if (KEY_F4 == key && WL_KEYBOARD_KEY_STATE_PRESSED == state)
{
exit(0);
}
}
void keyboard_modifiers(void *data,
HKEYBOARD wl_keyboard,
uint32_t serial,
uint32_t mods_depressed,
uint32_t mods_latched,
uint32_t mods_locked,
uint32_t group)
{
}
struct wl_keyboard_listener keyboard_listener =
{
.keymap = keyboard_keymap,
.enter = keyboard_enter,
.leave = keyboard_leave,
.key = keyboard_key,
.modifiers = keyboard_modifiers
};
转载于:https://my.oschina.net/txl/blog/266932