diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-06-19 15:15:37 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2017-06-19 15:15:37 -0400 |
commit | 632a04f1b7dea35f46a2fa478bf53869854a1b5e (patch) | |
tree | c5b5a57ddf085993a16a5c9f29076b90f3baccf1 /backend/libinput | |
parent | ecb04afcadc96cc8d39749311e4c1c412bebf4a9 (diff) |
Implement keyboard LEDs
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/keyboard.c | 23 |
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, |