Wayland helloworld (三)之Wayland键盘消息

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
};





你可能感兴趣的:(linux,Wayland)