aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/wayland/backend.c6
-rw-r--r--backend/wayland/tablet_v2.c26
-rw-r--r--include/backend/wayland.h4
-rw-r--r--include/wlr/types/wlr_tablet_tool.h2
4 files changed, 16 insertions, 22 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index b1d08568..7afd5e7e 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -21,10 +21,6 @@
#include "xdg-shell-client-protocol.h"
#include "tablet-unstable-v2-client-protocol.h"
-struct wlr_wl_tablet_seat *wlr_wl_add_tablet_seat(
- struct zwp_tablet_manager_v2 *manager,
- struct wl_seat *seat, struct wlr_wl_backend *backend);
-
struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend) {
assert(wlr_backend_is_wl(backend));
return (struct wlr_wl_backend *)backend;
@@ -118,7 +114,7 @@ static bool backend_start(struct wlr_backend *backend) {
}
if (wl->tablet_manager && wl->seat) {
- wlr_wl_add_tablet_seat(wl->tablet_manager,
+ wl_add_tablet_seat(wl->tablet_manager,
wl->seat, wl);
}
diff --git a/backend/wayland/tablet_v2.c b/backend/wayland/tablet_v2.c
index 10a6d84d..e327fbd1 100644
--- a/backend/wayland/tablet_v2.c
+++ b/backend/wayland/tablet_v2.c
@@ -16,13 +16,10 @@
#include "wlr/util/log.h"
#include "tablet-unstable-v2-client-protocol.h"
-#include <backend/wayland.h>
+#include "backend/wayland.h"
struct wlr_wl_tablet_seat {
struct zwp_tablet_seat_v2 *tablet_seat;
- struct wl_list tablets;
- struct wl_list tools;
-// struct wl_list pads; // wlr_wl_tablet_pad::link
};
struct wlr_wl_tablet_tool {
@@ -92,10 +89,6 @@ static uint32_t get_current_time_msec(void) {
return now.tv_nsec / (1000 * 1000) + now.tv_sec * 1000;
}
-struct wlr_wl_tablet_seat *wlr_wl_add_tablet_seat(
- struct zwp_tablet_manager_v2 *manager,
- struct wl_seat *seat, struct wlr_wl_backend *backend);
-
static void handle_tablet_pad_ring_source(void *data,
struct zwp_tablet_pad_ring_v2 *zwp_tablet_pad_ring_v2,
uint32_t source) {
@@ -207,6 +200,7 @@ static void handle_tablet_pad_group_buttons(void *data,
struct wl_array *buttons) {
struct wlr_wl_tablet_pad_group *group = data;
+ free(group->group.buttons);
group->group.buttons = calloc(1, buttons->size);
if (!group->group.buttons) {
// FIXME: Add actual error handling
@@ -470,9 +464,10 @@ static void handle_tablet_tool_done(void *data,
struct zwp_tablet_tool_v2 *id) {
/* empty */
}
+
static enum wlr_tablet_tool_type tablet_type_to_wlr_type(enum zwp_tablet_tool_v2_type type) {
- switch(type) {
+ switch (type) {
case ZWP_TABLET_TOOL_V2_TYPE_PEN:
return WLR_TABLET_TOOL_TYPE_PEN;
case ZWP_TABLET_TOOL_V2_TYPE_ERASER:
@@ -527,7 +522,7 @@ static void handle_tablet_tool_capability(void *data,
enum zwp_tablet_tool_v2_capability cap = capability;
- switch(cap) {
+ switch (cap) {
case ZWP_TABLET_TOOL_V2_CAPABILITY_TILT:
tool->wlr_tool.tilt = true;
break;
@@ -841,6 +836,8 @@ static void handle_tablet_name(void *data, struct zwp_tablet_v2 *zwp_tablet_v2,
const char *name) {
struct wlr_wl_input_device *dev = data;
struct wlr_tablet *tablet = dev->wlr_input_device.tablet;
+
+ free(tablet->name);
tablet->name = strdup(name);
}
@@ -894,12 +891,13 @@ static void handle_tab_added(void *data,
struct wlr_wl_backend *backend = data;
struct wlr_wl_input_device *dev = create_wl_input_device(
backend, WLR_INPUT_DEVICE_TABLET_TOOL);
- dev->resource = id;
if (!dev) {
zwp_tablet_v2_destroy(id);
return;
}
+ dev->resource = id;
+
struct wlr_input_device *wlr_dev = &dev->wlr_input_device;
wlr_dev->tablet = calloc(1, sizeof(*wlr_dev->tablet));
@@ -918,7 +916,7 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
.pad_added = handle_pad_added,
};
-struct wlr_wl_tablet_seat *wlr_wl_add_tablet_seat(
+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_tablet_seat *ret =
@@ -933,9 +931,5 @@ struct wlr_wl_tablet_seat *wlr_wl_add_tablet_seat(
zwp_tablet_seat_v2_add_listener(ret->tablet_seat,
&tablet_seat_listener, backend);
- wl_list_init(&ret->tablets);
- wl_list_init(&ret->tools);
- //wl_list_init(&ret->pads);
-
return ret;
}
diff --git a/include/backend/wayland.h b/include/backend/wayland.h
index f46e6c75..a237ced7 100644
--- a/include/backend/wayland.h
+++ b/include/backend/wayland.h
@@ -98,4 +98,8 @@ struct wlr_wl_input_device *create_wl_input_device(
extern const struct wl_seat_listener 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);
+
#endif
diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h
index bd797915..805727d4 100644
--- a/include/wlr/types/wlr_tablet_tool.h
+++ b/include/wlr/types/wlr_tablet_tool.h
@@ -70,7 +70,7 @@ struct wlr_tablet {
struct wl_signal button;
} events;
- const char *name;
+ char *name;
struct wlr_list paths; // char *
void *data;