Reassign ownership of libinput handle

This commit is contained in:
Drew DeVault 2017-06-10 12:21:54 -04:00
parent f479b7c8c7
commit 7a5f35b5bb
8 changed files with 64 additions and 23 deletions

View file

@ -8,23 +8,10 @@
#include "common/log.h"
#include "types.h"
static void wlr_libinput_keyboard_destroy(struct wlr_keyboard_state *state) {
libinput_device_unref(state->handle);
free(state);
}
static struct wlr_keyboard_impl keyboard_impl = {
.destroy = wlr_libinput_keyboard_destroy
};
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->handle = device;
libinput_device_ref(device);
return wlr_keyboard_create(&keyboard_impl, kbstate);
return wlr_keyboard_create(NULL, NULL);
}
void handle_keyboard_key(struct libinput_event *event,