aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/keyboard.c
diff options
context:
space:
mode:
authornyorain <nyorain@gmail.com>2017-06-19 21:22:42 +0200
committernyorain <nyorain@gmail.com>2017-06-19 21:22:42 +0200
commite65ca967f9f025748ce0710a09450ce05c5a36dd (patch)
tree79a78aadee4de5e16f9e4d67510463e628a95909 /backend/libinput/keyboard.c
parent10526de444b58ab4959d086538845303a06acfc1 (diff)
parent41b5294013cdf054e9dd49ef83ca6fee74f769a4 (diff)
Merge branch 'master' into wayland-backend
Diffstat (limited to 'backend/libinput/keyboard.c')
-rw-r--r--backend/libinput/keyboard.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c
index 9ad41a78..f94f0103 100644
--- a/backend/libinput/keyboard.c
+++ b/backend/libinput/keyboard.c
@@ -8,11 +8,32 @@
#include "common/log.h"
#include "types.h"
+struct wlr_keyboard_state {
+ struct libinput_device *device;
+};
+
+static void wlr_libinput_keyboard_set_leds(struct wlr_keyboard_state *kbstate, uint32_t leds) {
+ libinput_device_led_update(kbstate->device, leds);
+}
+
+static void wlr_libinput_keyboard_destroy(struct wlr_keyboard_state *kbstate) {
+ libinput_device_unref(kbstate->device);
+ free(kbstate);
+}
+
+struct wlr_keyboard_impl impl = {
+ .destroy = wlr_libinput_keyboard_destroy,
+ .led_update = wlr_libinput_keyboard_set_leds
+};
+
struct wlr_keyboard *wlr_libinput_keyboard_create(
struct libinput_device *device) {
assert(device);
+ struct wlr_keyboard_state *kbstate = calloc(1, sizeof(struct wlr_keyboard_state));
+ kbstate->device = device;
+ libinput_device_ref(device);
libinput_device_led_update(device, 0);
- return wlr_keyboard_create(NULL, NULL);
+ return wlr_keyboard_create(&impl, kbstate);
}
void handle_keyboard_key(struct libinput_event *event,