aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Zeni <simon@bl4ckb0ne.ca>2022-03-08 15:15:32 -0500
committerKirill Primak <vyivel@eclair.cafe>2022-03-17 17:16:47 +0000
commitb7e9ad7989a1525a581cfb7065c3f8d576de03da (patch)
treef2d9e72560c1174042d816452618a7e2c5026285 /backend
parent56f7c000b540b929bbdb0111b91108b1651924e6 (diff)
backend/wayland: remove wlr_wl_input_device
Diffstat (limited to 'backend')
-rw-r--r--backend/wayland/backend.c6
-rw-r--r--backend/wayland/seat.c103
2 files changed, 1 insertions, 108 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index 3428488e..998757f5 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -441,11 +441,6 @@ static void backend_destroy(struct wlr_backend *backend) {
wlr_output_destroy(&output->wlr_output);
}
- struct wlr_wl_input_device *input_device, *tmp_input_device;
- wl_list_for_each_safe(input_device, tmp_input_device, &wl->devices, link) {
- destroy_wl_input_device(input_device);
- }
-
struct wlr_wl_buffer *buffer, *tmp_buffer;
wl_list_for_each_safe(buffer, tmp_buffer, &wl->buffers, link) {
destroy_wl_buffer(buffer);
@@ -538,7 +533,6 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
wlr_backend_init(&wl->backend, &backend_impl);
wl->local_display = display;
- wl_list_init(&wl->devices);
wl_list_init(&wl->outputs);
wl_list_init(&wl->seats);
wl_list_init(&wl->buffers);
diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c
index 854447ee..768c4083 100644
--- a/backend/wayland/seat.c
+++ b/backend/wayland/seat.c
@@ -14,9 +14,9 @@
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/interfaces/wlr_tablet_pad.h>
+#include <wlr/types/wlr_input_device.h>
#include <wlr/util/log.h>
-#include "interfaces/wlr_input_device.h"
#include "backend/wayland.h"
#include "util/signal.h"
#include "util/time.h"
@@ -222,12 +222,6 @@ static void init_seat_touch(struct wlr_wl_seat *seat) {
&seat->wlr_touch.base);
}
-static struct wlr_wl_input_device *get_wl_input_device_from_input_device(
- struct wlr_input_device *wlr_dev) {
- assert(wlr_input_device_is_wl(wlr_dev));
- return (struct wlr_wl_input_device *)wlr_dev;
-}
-
bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl) {
struct wlr_wl_seat *seat = calloc(1, sizeof(struct wlr_wl_seat));
if (!seat) {
@@ -268,13 +262,6 @@ void destroy_wl_seats(struct wlr_wl_backend *wl) {
}
}
-static struct wlr_wl_seat *input_device_get_seat(struct wlr_input_device *wlr_dev) {
- struct wlr_wl_input_device *dev =
- get_wl_input_device_from_input_device(wlr_dev);
- assert(dev->seat);
- return dev->seat;
-}
-
bool wlr_input_device_is_wl(struct wlr_input_device *dev) {
switch (dev->type) {
case WLR_INPUT_DEVICE_KEYBOARD:
@@ -292,90 +279,6 @@ bool wlr_input_device_is_wl(struct wlr_input_device *dev) {
}
}
-struct wlr_wl_input_device *create_wl_input_device(
- struct wlr_wl_seat *seat, enum wlr_input_device_type type) {
- struct wlr_wl_input_device *dev =
- calloc(1, sizeof(struct wlr_wl_input_device));
- if (dev == NULL) {
- wlr_log_errno(WLR_ERROR, "Allocation failed");
- return NULL;
- }
- dev->backend = seat->backend;
- dev->seat = seat;
-
- struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
-
- const char *type_name = "unknown";
-
- switch (type) {
- case WLR_INPUT_DEVICE_KEYBOARD:
- wlr_log(WLR_ERROR, "can't create keyboard wlr_wl_input_device");
- free(dev);
- return NULL;
- case WLR_INPUT_DEVICE_POINTER:
- wlr_log(WLR_ERROR, "can't create pointer wlr_wl_input_device");
- free(dev);
- return NULL;
- case WLR_INPUT_DEVICE_TOUCH:
- wlr_log(WLR_ERROR, "can't create touch wlr_wl_input_device");
- free(dev);
- return NULL;
- case WLR_INPUT_DEVICE_TABLET_TOOL:
- wlr_log(WLR_ERROR, "can't create tablet tool wlr_wl_input_device");
- free(dev);
- return NULL;
- case WLR_INPUT_DEVICE_TABLET_PAD:
- wlr_log(WLR_ERROR, "can't create tablet pad wlr_wl_input_device");
- free(dev);
- return NULL;
- default:
- wlr_log(WLR_ERROR, "device not handled");
- free(dev);
- return NULL;
- }
-
- size_t name_size = 8 + strlen(type_name) + strlen(seat->name) + 1;
- char name[name_size];
- (void) snprintf(name, name_size, "wayland-%s-%s", type_name, seat->name);
-
- wlr_input_device_init(wlr_dev, type, name);
- wl_list_insert(&seat->backend->devices, &dev->link);
- return dev;
-}
-
-void destroy_wl_input_device(struct wlr_wl_input_device *dev) {
- /**
- * TODO remove the redundant wlr_input_device from wlr_wl_input_device
- * wlr_wl_input_device::wlr_input_device is not owned by its input device
- * type, which means we have 2 wlr_input_device to cleanup
- */
- wlr_input_device_finish(&dev->wlr_input_device);
- if (dev->wlr_input_device._device) {
- struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
- switch (wlr_dev->type) {
- case WLR_INPUT_DEVICE_KEYBOARD:
- wlr_log(WLR_ERROR, "wlr_wl_input_device has no keyboard");
- break;
- case WLR_INPUT_DEVICE_POINTER:
- wlr_log(WLR_ERROR, "wlr_wl_input_device has no pointer");
- break;
- case WLR_INPUT_DEVICE_TABLET_PAD:
- wlr_log(WLR_ERROR, "wlr_wl_input_device has no tablet pad");
- break;
- case WLR_INPUT_DEVICE_TABLET_TOOL:
- wlr_log(WLR_ERROR, "wlr_wl_input_device has no tablet_tool");
- break;
- case WLR_INPUT_DEVICE_TOUCH:
- wlr_log(WLR_ERROR, "wlr_wl_input_device has no touch");
- break;
- default:
- break;
- }
- }
- wl_list_remove(&dev->link);
- free(dev);
-}
-
static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
enum wl_seat_capability caps) {
struct wlr_wl_seat *seat = data;
@@ -437,7 +340,3 @@ const struct wl_seat_listener seat_listener = {
.capabilities = seat_handle_capabilities,
.name = seat_handle_name,
};
-
-struct wl_seat *wlr_wl_input_device_get_seat(struct wlr_input_device *wlr_dev) {
- return input_device_get_seat(wlr_dev)->wl_seat;
-}