wlroots/types/wlr_keyboard.c

30 lines
607 B
C
Raw Normal View History

2017-06-09 21:31:21 +00:00
#include <stdlib.h>
#include <string.h>
#include <wayland-server.h>
2017-06-21 14:27:45 +00:00
#include <wlr/types/wlr_keyboard.h>
#include <wlr/interfaces/wlr_keyboard.h>
2017-06-09 21:31:21 +00:00
2017-08-14 13:41:14 +00:00
void wlr_keyboard_init(struct wlr_keyboard *kb,
struct wlr_keyboard_impl *impl) {
2017-06-09 21:31:21 +00:00
kb->impl = impl;
wl_signal_init(&kb->events.key);
}
void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
2017-08-14 15:09:56 +00:00
if (!kb) {
return;
}
2017-08-14 13:41:14 +00:00
if (kb->impl && kb->impl->destroy) {
kb->impl->destroy(kb);
} else {
free(kb);
2017-06-14 15:40:03 +00:00
}
2017-06-09 21:31:21 +00:00
}
2017-06-19 19:15:37 +00:00
void wlr_keyboard_led_update(struct wlr_keyboard *kb, uint32_t leds) {
2017-08-14 13:41:14 +00:00
if (kb->impl && kb->impl->led_update) {
kb->impl->led_update(kb, leds);
2017-06-19 19:15:37 +00:00
}
}