wlroots-hyprland/types/wlr_keyboard.c

29 lines
682 B
C
Raw Normal View History

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
struct wlr_keyboard *wlr_keyboard_create(struct wlr_keyboard_impl *impl,
struct wlr_keyboard_state *state) {
struct wlr_keyboard *kb = calloc(1, sizeof(struct wlr_keyboard));
kb->impl = impl;
kb->state = state;
wl_signal_init(&kb->events.key);
return kb;
}
void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
if (!kb) return;
2017-06-14 17:40:03 +02:00
if (kb->impl) {
kb->impl->destroy(kb->state);
}
2017-06-09 23:31:21 +02:00
free(kb);
}
2017-06-19 21:15:37 +02:00
void wlr_keyboard_led_update(struct wlr_keyboard *kb, uint32_t leds) {
if (kb->impl) {
kb->impl->led_update(kb->state, leds);
}
}