2018-04-29 13:15:54 +02:00
|
|
|
#define _POSIX_C_SOURCE 200809L
|
2017-06-09 23:31:21 +02:00
|
|
|
#include <assert.h>
|
|
|
|
#include <libinput.h>
|
2018-02-12 21:29:23 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <wayland-util.h>
|
2017-07-11 09:18:34 +02:00
|
|
|
#include <wlr/backend/session.h>
|
2017-06-21 18:10:07 +02:00
|
|
|
#include <wlr/util/log.h>
|
2017-06-10 17:58:25 +02:00
|
|
|
#include "backend/libinput.h"
|
2021-07-01 10:08:56 +02:00
|
|
|
#include "util/array.h"
|
2018-02-12 21:29:23 +01:00
|
|
|
#include "util/signal.h"
|
2017-06-09 23:31:21 +02:00
|
|
|
|
2017-06-10 17:58:25 +02:00
|
|
|
struct wlr_input_device *get_appropriate_device(
|
2017-06-09 23:52:11 +02:00
|
|
|
enum wlr_input_device_type desired_type,
|
2017-08-13 00:50:09 +02:00
|
|
|
struct libinput_device *libinput_dev) {
|
2017-10-14 18:17:43 +02:00
|
|
|
struct wl_list *wlr_devices = libinput_device_get_user_data(libinput_dev);
|
2017-08-13 00:50:09 +02:00
|
|
|
if (!wlr_devices) {
|
2017-06-09 23:52:11 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2021-11-22 22:30:40 +01:00
|
|
|
struct wlr_libinput_input_device *dev;
|
2017-10-14 18:17:43 +02:00
|
|
|
wl_list_for_each(dev, wlr_devices, link) {
|
2021-11-22 22:30:40 +01:00
|
|
|
if (dev->wlr_input_device.type == desired_type) {
|
|
|
|
return &dev->wlr_input_device;
|
2017-06-09 23:52:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-02-23 16:42:20 +01:00
|
|
|
|
2022-02-09 22:03:12 +01:00
|
|
|
void destroy_libinput_input_device(struct wlr_libinput_input_device *dev)
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* TODO remove the redundant wlr_input_device from wlr_libinput_input_device
|
|
|
|
* wlr_libinput_input_device::wlr_input_device is not owned by its input
|
|
|
|
* device type, which means we have 2 wlr_input_device to cleanup
|
|
|
|
*/
|
|
|
|
if (dev->wlr_input_device._device) {
|
|
|
|
wlr_input_device_destroy(&dev->wlr_input_device);
|
2022-02-23 16:42:20 +01:00
|
|
|
wlr_input_device_finish(&dev->wlr_input_device);
|
|
|
|
} else {
|
|
|
|
if (dev->keyboard.impl) {
|
|
|
|
wlr_keyboard_destroy(&dev->keyboard);
|
|
|
|
}
|
2022-02-28 17:57:35 +01:00
|
|
|
if (dev->pointer.impl) {
|
|
|
|
wlr_pointer_destroy(&dev->pointer);
|
|
|
|
}
|
2022-02-09 22:03:12 +01:00
|
|
|
}
|
|
|
|
|
2017-08-14 14:54:53 +02:00
|
|
|
libinput_device_unref(dev->handle);
|
2021-11-22 22:30:40 +01:00
|
|
|
wl_list_remove(&dev->link);
|
2017-08-14 14:54:53 +02:00
|
|
|
free(dev);
|
2017-06-10 18:21:54 +02:00
|
|
|
}
|
|
|
|
|
2017-06-14 17:40:03 +02:00
|
|
|
static struct wlr_input_device *allocate_device(
|
2018-09-17 21:53:03 +02:00
|
|
|
struct wlr_libinput_backend *backend,
|
|
|
|
struct libinput_device *libinput_dev, struct wl_list *wlr_devices,
|
|
|
|
enum wlr_input_device_type type) {
|
2017-08-13 00:50:09 +02:00
|
|
|
const char *name = libinput_device_get_name(libinput_dev);
|
2018-09-17 21:53:03 +02:00
|
|
|
struct wlr_libinput_input_device *dev =
|
|
|
|
calloc(1, sizeof(struct wlr_libinput_input_device));
|
|
|
|
if (dev == NULL) {
|
2017-08-15 07:56:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2018-09-17 21:53:03 +02:00
|
|
|
struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
|
2018-03-28 17:40:35 +02:00
|
|
|
libinput_device_get_size(libinput_dev,
|
|
|
|
&wlr_dev->width_mm, &wlr_dev->height_mm);
|
2018-04-29 13:15:54 +02:00
|
|
|
const char *output_name = libinput_device_get_output_name(libinput_dev);
|
|
|
|
if (output_name != NULL) {
|
|
|
|
wlr_dev->output_name = strdup(output_name);
|
|
|
|
}
|
2021-11-22 22:30:40 +01:00
|
|
|
wl_list_insert(wlr_devices, &dev->link);
|
2018-09-17 21:53:03 +02:00
|
|
|
dev->handle = libinput_dev;
|
2017-08-13 00:50:09 +02:00
|
|
|
libinput_device_ref(libinput_dev);
|
2022-02-09 22:14:56 +01:00
|
|
|
wlr_input_device_init(wlr_dev, type, name);
|
2022-02-04 15:26:57 +01:00
|
|
|
wlr_dev->vendor = libinput_device_get_id_vendor(libinput_dev);
|
|
|
|
wlr_dev->product = libinput_device_get_id_product(libinput_dev);
|
2017-08-13 00:50:09 +02:00
|
|
|
return wlr_dev;
|
2017-06-13 16:27:15 +02:00
|
|
|
}
|
|
|
|
|
2017-12-19 19:46:30 +01:00
|
|
|
bool wlr_input_device_is_libinput(struct wlr_input_device *wlr_dev) {
|
2022-02-09 22:03:12 +01:00
|
|
|
switch (wlr_dev->type) {
|
|
|
|
case WLR_INPUT_DEVICE_KEYBOARD:
|
|
|
|
return wlr_dev->keyboard->impl == &libinput_keyboard_impl;
|
|
|
|
case WLR_INPUT_DEVICE_POINTER:
|
|
|
|
return wlr_dev->pointer->impl == &libinput_pointer_impl;
|
|
|
|
case WLR_INPUT_DEVICE_TOUCH:
|
|
|
|
return wlr_dev->touch->impl == &libinput_touch_impl;
|
|
|
|
case WLR_INPUT_DEVICE_TABLET_TOOL:
|
|
|
|
return wlr_dev->tablet->impl == &libinput_tablet_impl;
|
|
|
|
case WLR_INPUT_DEVICE_TABLET_PAD:
|
|
|
|
return wlr_dev->tablet_pad->impl == &libinput_tablet_pad_impl;
|
|
|
|
case WLR_INPUT_DEVICE_SWITCH:
|
|
|
|
return wlr_dev->switch_device->impl == &libinput_switch_impl;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2017-12-19 19:46:30 +01:00
|
|
|
}
|
|
|
|
|
2017-08-12 19:51:47 +02:00
|
|
|
static void handle_device_added(struct wlr_libinput_backend *backend,
|
2017-08-13 00:50:09 +02:00
|
|
|
struct libinput_device *libinput_dev) {
|
2017-06-09 23:31:21 +02:00
|
|
|
/*
|
|
|
|
* Note: the wlr API exposes only devices with a single capability, because
|
|
|
|
* that meshes better with how Wayland does things and is a bit simpler.
|
|
|
|
* However, libinput devices often have multiple capabilities - in such
|
|
|
|
* cases we have to create several devices.
|
|
|
|
*/
|
2017-08-13 00:50:09 +02:00
|
|
|
int vendor = libinput_device_get_id_vendor(libinput_dev);
|
|
|
|
int product = libinput_device_get_id_product(libinput_dev);
|
|
|
|
const char *name = libinput_device_get_name(libinput_dev);
|
2022-02-23 16:42:20 +01:00
|
|
|
wlr_log(WLR_DEBUG, "Added %s [%d:%d]", name, vendor, product);
|
|
|
|
|
|
|
|
struct wlr_libinput_input_device *dev =
|
|
|
|
calloc(1, sizeof(struct wlr_libinput_input_device));
|
|
|
|
if (dev == NULL) {
|
|
|
|
wlr_log_errno(WLR_ERROR, "failed to allocate wlr_libinput_input_device");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev->handle = libinput_dev;
|
|
|
|
libinput_device_ref(libinput_dev);
|
|
|
|
libinput_device_set_user_data(libinput_dev, dev);
|
|
|
|
|
|
|
|
bool dev_used = false;
|
|
|
|
|
|
|
|
if (libinput_device_has_capability(
|
|
|
|
libinput_dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
|
|
|
|
init_device_keyboard(dev);
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&backend->backend.events.new_input,
|
|
|
|
&dev->keyboard.base);
|
|
|
|
dev_used = true;
|
|
|
|
}
|
|
|
|
|
2022-02-28 17:57:35 +01:00
|
|
|
if (libinput_device_has_capability(
|
|
|
|
libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) {
|
|
|
|
init_device_pointer(dev);
|
|
|
|
|
|
|
|
wlr_signal_emit_safe(&backend->backend.events.new_input,
|
|
|
|
&dev->pointer.base);
|
|
|
|
|
|
|
|
dev_used = true;
|
|
|
|
}
|
2022-02-23 16:42:20 +01:00
|
|
|
|
|
|
|
if (dev_used) {
|
|
|
|
wl_list_insert(&backend->devices, &dev->link);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
libinput_device_unref(libinput_dev);
|
|
|
|
free(dev);
|
|
|
|
}
|
|
|
|
|
2017-10-14 18:17:43 +02:00
|
|
|
struct wl_list *wlr_devices = calloc(1, sizeof(struct wl_list));
|
2017-08-15 07:56:47 +02:00
|
|
|
if (!wlr_devices) {
|
2018-07-09 23:49:54 +02:00
|
|
|
wlr_log(WLR_ERROR, "Allocation failed");
|
2017-11-16 10:30:54 +01:00
|
|
|
return;
|
2017-08-15 07:56:47 +02:00
|
|
|
}
|
2017-11-16 10:30:54 +01:00
|
|
|
wl_list_init(wlr_devices);
|
2017-06-09 23:31:21 +02:00
|
|
|
|
2018-09-17 21:53:03 +02:00
|
|
|
if (libinput_device_has_capability(
|
|
|
|
libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
|
2017-08-13 00:50:09 +02:00
|
|
|
struct wlr_input_device *wlr_dev = allocate_device(backend,
|
|
|
|
libinput_dev, wlr_devices, WLR_INPUT_DEVICE_TOUCH);
|
2017-08-15 07:56:47 +02:00
|
|
|
if (!wlr_dev) {
|
|
|
|
goto fail;
|
|
|
|
}
|
2018-04-26 00:24:58 +02:00
|
|
|
wlr_dev->touch = create_libinput_touch(libinput_dev);
|
2017-08-15 07:56:47 +02:00
|
|
|
if (!wlr_dev->touch) {
|
|
|
|
free(wlr_dev);
|
|
|
|
goto fail;
|
|
|
|
}
|
2018-02-12 10:36:43 +01:00
|
|
|
wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
2018-09-17 21:53:03 +02:00
|
|
|
if (libinput_device_has_capability(libinput_dev,
|
|
|
|
LIBINPUT_DEVICE_CAP_TABLET_TOOL)) {
|
2017-08-13 00:50:09 +02:00
|
|
|
struct wlr_input_device *wlr_dev = allocate_device(backend,
|
|
|
|
libinput_dev, wlr_devices, WLR_INPUT_DEVICE_TABLET_TOOL);
|
2017-08-15 07:56:47 +02:00
|
|
|
if (!wlr_dev) {
|
|
|
|
goto fail;
|
|
|
|
}
|
2018-06-16 11:19:48 +02:00
|
|
|
wlr_dev->tablet = create_libinput_tablet(libinput_dev);
|
|
|
|
if (!wlr_dev->tablet) {
|
2017-08-15 07:56:47 +02:00
|
|
|
free(wlr_dev);
|
|
|
|
goto fail;
|
|
|
|
}
|
2018-02-12 10:36:43 +01:00
|
|
|
wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
2018-09-17 21:53:03 +02:00
|
|
|
if (libinput_device_has_capability(
|
|
|
|
libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) {
|
2017-08-13 00:50:09 +02:00
|
|
|
struct wlr_input_device *wlr_dev = allocate_device(backend,
|
|
|
|
libinput_dev, wlr_devices, WLR_INPUT_DEVICE_TABLET_PAD);
|
2017-08-15 07:56:47 +02:00
|
|
|
if (!wlr_dev) {
|
|
|
|
goto fail;
|
|
|
|
}
|
2018-04-26 00:24:58 +02:00
|
|
|
wlr_dev->tablet_pad = create_libinput_tablet_pad(libinput_dev);
|
2017-08-15 07:56:47 +02:00
|
|
|
if (!wlr_dev->tablet_pad) {
|
|
|
|
free(wlr_dev);
|
|
|
|
goto fail;
|
|
|
|
}
|
2018-02-12 10:36:43 +01:00
|
|
|
wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
2018-09-17 21:53:03 +02:00
|
|
|
if (libinput_device_has_capability(
|
|
|
|
libinput_dev, LIBINPUT_DEVICE_CAP_GESTURE)) {
|
2017-06-09 23:31:21 +02:00
|
|
|
// TODO
|
|
|
|
}
|
2018-09-17 21:53:03 +02:00
|
|
|
if (libinput_device_has_capability(
|
|
|
|
libinput_dev, LIBINPUT_DEVICE_CAP_SWITCH)) {
|
2018-11-15 00:24:55 +01:00
|
|
|
struct wlr_input_device *wlr_dev = allocate_device(backend,
|
|
|
|
libinput_dev, wlr_devices, WLR_INPUT_DEVICE_SWITCH);
|
|
|
|
if (!wlr_dev) {
|
|
|
|
goto fail;
|
|
|
|
}
|
2019-03-19 23:41:20 +01:00
|
|
|
wlr_dev->switch_device = create_libinput_switch(libinput_dev);
|
|
|
|
if (!wlr_dev->switch_device) {
|
2018-11-15 00:24:55 +01:00
|
|
|
free(wlr_dev);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
|
|
|
|
2018-09-17 21:53:03 +02:00
|
|
|
if (!wl_list_empty(wlr_devices)) {
|
2021-07-01 10:08:56 +02:00
|
|
|
struct wl_list **dst = wl_array_add(&backend->wlr_device_lists, sizeof(wlr_devices));
|
|
|
|
if (!dst) {
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
*dst = wlr_devices;
|
|
|
|
|
2017-08-13 00:50:09 +02:00
|
|
|
libinput_device_set_user_data(libinput_dev, wlr_devices);
|
2017-06-09 23:31:21 +02:00
|
|
|
} else {
|
2017-10-14 18:17:43 +02:00
|
|
|
free(wlr_devices);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
2017-08-15 07:56:47 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
fail:
|
2018-07-09 23:49:54 +02:00
|
|
|
wlr_log(WLR_ERROR, "Could not allocate new device");
|
2022-02-23 16:42:20 +01:00
|
|
|
struct wlr_libinput_input_device *device, *tmp;
|
|
|
|
wl_list_for_each_safe(device, tmp, wlr_devices, link) {
|
|
|
|
free(device);
|
2017-10-14 18:17:43 +02:00
|
|
|
}
|
|
|
|
free(wlr_devices);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
|
|
|
|
2017-08-12 19:51:47 +02:00
|
|
|
static void handle_device_removed(struct wlr_libinput_backend *backend,
|
2017-08-13 00:50:09 +02:00
|
|
|
struct libinput_device *libinput_dev) {
|
|
|
|
int vendor = libinput_device_get_id_vendor(libinput_dev);
|
|
|
|
int product = libinput_device_get_id_product(libinput_dev);
|
|
|
|
const char *name = libinput_device_get_name(libinput_dev);
|
2018-07-09 23:49:54 +02:00
|
|
|
wlr_log(WLR_DEBUG, "Removing %s [%d:%d]", name, vendor, product);
|
2022-02-22 22:17:48 +01:00
|
|
|
|
2022-02-23 16:42:20 +01:00
|
|
|
// TODO: use libinput_device_get_user_data(libinput_dev);
|
2022-02-22 22:17:48 +01:00
|
|
|
if (!wl_list_empty(&backend->devices)) {
|
|
|
|
struct wlr_libinput_input_device *dev, *tmp_dev;
|
|
|
|
wl_list_for_each_safe(dev, tmp_dev, &backend->devices, link) {
|
|
|
|
if (dev->handle == libinput_dev) {
|
|
|
|
destroy_libinput_input_device(dev);
|
2022-02-23 16:42:20 +01:00
|
|
|
return;
|
2022-02-22 22:17:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-23 16:42:20 +01:00
|
|
|
struct wl_list *wlr_devices = libinput_device_get_user_data(libinput_dev);
|
2017-08-13 00:50:09 +02:00
|
|
|
if (!wlr_devices) {
|
2017-08-12 15:13:29 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-11-22 22:30:40 +01:00
|
|
|
struct wlr_libinput_input_device *dev, *tmp_dev;
|
2017-10-14 18:17:43 +02:00
|
|
|
wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) {
|
2022-02-09 22:03:12 +01:00
|
|
|
destroy_libinput_input_device(dev);
|
2017-08-11 22:46:50 +02:00
|
|
|
}
|
2021-07-01 10:08:56 +02:00
|
|
|
size_t i = 0;
|
2021-07-08 13:39:33 +02:00
|
|
|
struct wl_list **ptr;
|
|
|
|
wl_array_for_each(ptr, &backend->wlr_device_lists) {
|
|
|
|
struct wl_list *iter = *ptr;
|
2021-07-01 10:08:56 +02:00
|
|
|
if (iter == wlr_devices) {
|
|
|
|
array_remove_at(&backend->wlr_device_lists,
|
|
|
|
i * sizeof(struct wl_list *), sizeof(struct wl_list *));
|
2017-08-11 22:46:50 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-07-01 10:08:56 +02:00
|
|
|
i++;
|
2017-08-11 22:46:50 +02:00
|
|
|
}
|
2017-10-14 18:17:43 +02:00
|
|
|
free(wlr_devices);
|
2017-06-09 23:31:21 +02:00
|
|
|
}
|
|
|
|
|
2018-04-26 00:24:58 +02:00
|
|
|
void handle_libinput_event(struct wlr_libinput_backend *backend,
|
2017-06-09 23:31:21 +02:00
|
|
|
struct libinput_event *event) {
|
2017-08-13 00:50:09 +02:00
|
|
|
struct libinput_device *libinput_dev = libinput_event_get_device(event);
|
2022-02-23 16:42:20 +01:00
|
|
|
struct wlr_libinput_input_device *dev =
|
|
|
|
libinput_device_get_user_data(libinput_dev);
|
2017-06-09 23:31:21 +02:00
|
|
|
enum libinput_event_type event_type = libinput_event_get_type(event);
|
|
|
|
switch (event_type) {
|
|
|
|
case LIBINPUT_EVENT_DEVICE_ADDED:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_device_added(backend, libinput_dev);
|
2017-06-09 23:31:21 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_DEVICE_REMOVED:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_device_removed(backend, libinput_dev);
|
2017-06-09 23:52:11 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_KEYBOARD_KEY:
|
2022-02-23 16:42:20 +01:00
|
|
|
handle_keyboard_key(event, &dev->keyboard);
|
2017-06-09 23:31:21 +02:00
|
|
|
break;
|
2017-06-13 16:27:15 +02:00
|
|
|
case LIBINPUT_EVENT_POINTER_MOTION:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_motion(event, &dev->pointer);
|
2017-06-13 16:27:15 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_motion_abs(event, &dev->pointer);
|
2017-06-13 16:27:15 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_POINTER_BUTTON:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_button(event, &dev->pointer);
|
2017-06-13 16:27:15 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_POINTER_AXIS:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_axis(event, &dev->pointer);
|
2017-06-13 16:27:15 +02:00
|
|
|
break;
|
2017-06-14 20:50:09 +02:00
|
|
|
case LIBINPUT_EVENT_TOUCH_DOWN:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_touch_down(event, libinput_dev);
|
2017-06-14 20:50:09 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TOUCH_UP:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_touch_up(event, libinput_dev);
|
2017-06-14 20:50:09 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TOUCH_MOTION:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_touch_motion(event, libinput_dev);
|
2017-06-14 20:50:09 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TOUCH_CANCEL:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_touch_cancel(event, libinput_dev);
|
2017-06-14 20:50:09 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TOUCH_FRAME:
|
2021-06-30 11:39:17 +02:00
|
|
|
handle_touch_frame(event, libinput_dev);
|
2017-06-14 20:50:09 +02:00
|
|
|
break;
|
2017-06-15 20:32:28 +02:00
|
|
|
case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_tool_axis(event, libinput_dev);
|
2017-06-15 20:32:28 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_tool_proximity(event, libinput_dev);
|
2017-06-15 20:32:28 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TABLET_TOOL_TIP:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_tool_tip(event, libinput_dev);
|
2017-06-15 20:32:28 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TABLET_TOOL_BUTTON:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_tool_button(event, libinput_dev);
|
2017-06-15 20:32:28 +02:00
|
|
|
break;
|
2017-06-19 20:49:07 +02:00
|
|
|
case LIBINPUT_EVENT_TABLET_PAD_BUTTON:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_pad_button(event, libinput_dev);
|
2017-06-19 20:49:07 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TABLET_PAD_RING:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_pad_ring(event, libinput_dev);
|
2017-06-19 20:49:07 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_TABLET_PAD_STRIP:
|
2017-08-13 00:50:09 +02:00
|
|
|
handle_tablet_pad_strip(event, libinput_dev);
|
2017-06-19 20:49:07 +02:00
|
|
|
break;
|
2018-11-15 00:24:55 +01:00
|
|
|
case LIBINPUT_EVENT_SWITCH_TOGGLE:
|
|
|
|
handle_switch_toggle(event, libinput_dev);
|
|
|
|
break;
|
2019-01-25 23:51:38 +01:00
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_swipe_begin(event, &dev->pointer);
|
2019-01-25 23:51:38 +01:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_swipe_update(event, &dev->pointer);
|
2019-01-25 23:51:38 +01:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_GESTURE_SWIPE_END:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_swipe_end(event, &dev->pointer);
|
2019-01-25 23:51:38 +01:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_pinch_begin(event, &dev->pointer);
|
2019-01-25 23:51:38 +01:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_pinch_update(event, &dev->pointer);
|
2019-01-25 23:51:38 +01:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_GESTURE_PINCH_END:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_pinch_end(event, &dev->pointer);
|
2019-01-25 23:51:38 +01:00
|
|
|
break;
|
2021-07-12 19:50:44 +02:00
|
|
|
#if LIBINPUT_HAS_HOLD_GESTURES
|
|
|
|
case LIBINPUT_EVENT_GESTURE_HOLD_BEGIN:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_hold_begin(event, &dev->pointer);
|
2021-07-12 19:50:44 +02:00
|
|
|
break;
|
|
|
|
case LIBINPUT_EVENT_GESTURE_HOLD_END:
|
2022-02-28 17:57:35 +01:00
|
|
|
handle_pointer_hold_end(event, &dev->pointer);
|
2021-07-12 19:50:44 +02:00
|
|
|
break;
|
|
|
|
#endif
|
2017-06-09 23:31:21 +02:00
|
|
|
default:
|
2018-07-09 23:49:54 +02:00
|
|
|
wlr_log(WLR_DEBUG, "Unknown libinput event %d", event_type);
|
2017-06-09 23:31:21 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|