backend/libinput: rework keyboard interface

The wlr_libinput_input_device now owns its wlr_keyboard, instead of creating
a new wlr_libinput_input_device for it.
This commit is contained in:
Simon Zeni 2022-02-23 10:42:20 -05:00 committed by Kirill Primak
parent 9dd6e2b905
commit 5eefda1ffe
4 changed files with 83 additions and 70 deletions

View file

@ -238,8 +238,16 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
struct libinput_device *wlr_libinput_get_device_handle(
struct wlr_input_device *wlr_dev) {
struct wlr_libinput_input_device *dev =
(struct wlr_libinput_input_device *)wlr_dev;
struct wlr_libinput_input_device *dev = NULL;
switch (wlr_dev->type) {
case WLR_INPUT_DEVICE_KEYBOARD:
dev = device_from_keyboard(wlr_dev->keyboard);
break;
default:
dev = (struct wlr_libinput_input_device *)wlr_dev;
break;
}
return dev->handle;
}