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