diff options
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/backend.c | 2 | ||||
-rw-r--r-- | backend/libinput/events.c | 17 | ||||
-rw-r--r-- | backend/libinput/touch.c | 15 |
3 files changed, 27 insertions, 7 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 9b0a6d8c..82ba44a6 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -102,7 +102,7 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, goto error_state; } - if (!(state->keyboards = list_create())) { + if (!(state->devices = list_create())) { wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno)); goto error_backend; } diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 5ef58a3e..4af8082f 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -33,7 +33,8 @@ static struct wlr_input_device_impl input_device_impl = { .destroy = wlr_libinput_device_destroy }; -static struct wlr_input_device *allocate_device(struct libinput_device *device, +static struct wlr_input_device *allocate_device( + struct wlr_backend_state *state, struct libinput_device *device, list_t *devices, enum wlr_input_device_type type) { int vendor = libinput_device_get_id_vendor(device); int product = libinput_device_get_id_product(device); @@ -46,6 +47,7 @@ static struct wlr_input_device *allocate_device(struct libinput_device *device, type, &input_device_impl, devstate, name, vendor, product); list_add(devices, wlr_device); + list_add(state->devices, wlr_device); return wlr_device; } @@ -65,19 +67,22 @@ static void handle_device_added(struct wlr_backend_state *state, wlr_log(L_DEBUG, "Added %s [%d:%d]", name, vendor, product); if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) { - struct wlr_input_device *wlr_device = allocate_device(device, devices, - WLR_INPUT_DEVICE_KEYBOARD); + struct wlr_input_device *wlr_device = allocate_device(state, + device, devices, WLR_INPUT_DEVICE_KEYBOARD); wlr_device->keyboard = wlr_libinput_keyboard_create(device); wl_signal_emit(&state->backend->events.input_add, wlr_device); } if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER)) { - struct wlr_input_device *wlr_device = allocate_device(device, devices, - WLR_INPUT_DEVICE_POINTER); + struct wlr_input_device *wlr_device = allocate_device(state, + device, devices, WLR_INPUT_DEVICE_POINTER); wlr_device->pointer = wlr_libinput_pointer_create(device); wl_signal_emit(&state->backend->events.input_add, wlr_device); } if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH)) { - // TODO + struct wlr_input_device *wlr_device = allocate_device(state, + device, devices, WLR_INPUT_DEVICE_TOUCH); + wlr_device->touch = wlr_libinput_touch_create(device); + wl_signal_emit(&state->backend->events.input_add, wlr_device); } if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) { // TODO diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c new file mode 100644 index 00000000..55e8609a --- /dev/null +++ b/backend/libinput/touch.c @@ -0,0 +1,15 @@ +#include <stdlib.h> +#include <assert.h> +#include <libinput.h> +#include <wlr/session.h> +#include <wlr/types.h> +#include <wlr/common/list.h> +#include "backend/libinput.h" +#include "common/log.h" +#include "types.h" + +struct wlr_touch *wlr_libinput_touch_create( + struct libinput_device *device) { + assert(device); + return wlr_touch_create(NULL, NULL); +} |