aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/wayland/backend.c3
-rw-r--r--backend/wayland/seat.c15
-rw-r--r--backend/wayland/tablet_v2.c12
3 files changed, 13 insertions, 17 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index 459baaa6..4d814cd2 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -164,8 +164,7 @@ static bool backend_start(struct wlr_backend *backend) {
}
if (wl->tablet_manager) {
- wl_add_tablet_seat(wl->tablet_manager,
- seat->wl_seat, wl);
+ wl_add_tablet_seat(wl->tablet_manager, seat);
}
}
diff --git a/backend/wayland/seat.c b/backend/wayland/seat.c
index c1cd473d..56e8dc75 100644
--- a/backend/wayland/seat.c
+++ b/backend/wayland/seat.c
@@ -380,8 +380,9 @@ bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl) {
return false;
}
seat->wl_seat = wl_seat;
+ seat->backend = wl;
wl->seat = seat;
- wl_seat_add_listener(wl_seat, &seat_listener, wl);
+ wl_seat_add_listener(wl_seat, &seat_listener, seat);
return true;
}
@@ -408,11 +409,6 @@ void destroy_wl_seats(struct wlr_wl_backend *wl) {
free(seat);
}
-static struct wlr_wl_seat *backend_get_seat(struct wlr_wl_backend *backend, struct wl_seat *wl_seat) {
- assert(backend->seat && backend->seat->wl_seat == wl_seat);
- return backend->seat;
-}
-
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);
@@ -726,8 +722,8 @@ void create_wl_touch(struct wl_touch *wl_touch, struct wlr_wl_backend *wl) {
static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
enum wl_seat_capability caps) {
- struct wlr_wl_backend *backend = data;
- struct wlr_wl_seat *seat = backend_get_seat(backend, wl_seat);
+ struct wlr_wl_seat *seat = data;
+ struct wlr_wl_backend *backend = seat->backend;
if ((caps & WL_SEAT_CAPABILITY_POINTER) && seat->pointer == NULL) {
wlr_log(WLR_DEBUG, "seat %p offered pointer", (void *)wl_seat);
@@ -801,8 +797,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
static void seat_handle_name(void *data, struct wl_seat *wl_seat,
const char *name) {
- struct wlr_wl_backend *backend = data;
- struct wlr_wl_seat *seat = backend_get_seat(backend, wl_seat);
+ struct wlr_wl_seat *seat = data;
free(seat->name);
seat->name = strdup(name);
}
diff --git a/backend/wayland/tablet_v2.c b/backend/wayland/tablet_v2.c
index 826c36ba..cf2ae532 100644
--- a/backend/wayland/tablet_v2.c
+++ b/backend/wayland/tablet_v2.c
@@ -429,7 +429,8 @@ static void handle_pad_added(void *data,
struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
struct zwp_tablet_pad_v2 *id) {
wlr_log(WLR_DEBUG, "New tablet pad");
- struct wlr_wl_backend *backend = data;
+ struct wlr_wl_seat *seat = data;
+ struct wlr_wl_backend *backend = seat->backend;
struct wlr_wl_input_device *dev = create_wl_input_device(
backend, WLR_INPUT_DEVICE_TABLET_PAD);
if (!dev) {
@@ -889,7 +890,8 @@ static void handle_tab_added(void *data,
struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2,
struct zwp_tablet_v2 *id) {
wlr_log(WLR_DEBUG, "New tablet");
- struct wlr_wl_backend *backend = data;
+ struct wlr_wl_seat *seat = data;
+ struct wlr_wl_backend *backend = seat->backend;
struct wlr_wl_input_device *dev = create_wl_input_device(
backend, WLR_INPUT_DEVICE_TABLET_TOOL);
@@ -919,18 +921,18 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
struct wlr_wl_tablet_seat *wl_add_tablet_seat(
struct zwp_tablet_manager_v2 *manager,
- struct wl_seat *seat, struct wlr_wl_backend *backend) {
+ struct wlr_wl_seat *seat) {
struct wlr_wl_tablet_seat *ret =
calloc(1, sizeof(struct wlr_wl_tablet_seat));
if (!(ret->tablet_seat =
- zwp_tablet_manager_v2_get_tablet_seat(manager, seat))) {
+ zwp_tablet_manager_v2_get_tablet_seat(manager, seat->wl_seat))) {
free(ret);
return NULL;
}
zwp_tablet_seat_v2_add_listener(ret->tablet_seat,
- &tablet_seat_listener, backend);
+ &tablet_seat_listener, seat);
return ret;
}