aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorMarkus Ongyerth <ongy@ongy.net>2018-05-19 14:35:02 +0200
committerMarkus Ongyerth <ongy@ongy.net>2018-07-14 09:48:57 +0200
commit3be916f9b8dd697d5876e017b544e3d42c11397e (patch)
tree78f9a9e47ade2bf6b2dfed9f16f36a4f08dc6994 /backend
parent2bc09d91c3f9c0afe093e77491521da8ed85b4cf (diff)
Add asserts and rename destroy function in libinput backend
Diffstat (limited to 'backend')
-rw-r--r--backend/libinput/tablet_tool.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c
index 5dc0584c..d780330a 100644
--- a/backend/libinput/tablet_tool.c
+++ b/backend/libinput/tablet_tool.c
@@ -13,6 +13,12 @@
#include "backend/libinput.h"
#include "util/signal.h"
+static struct wlr_tablet_tool_impl tool_impl;
+
+static bool tablet_tool_is_libinput(struct wlr_tablet_tool *tool) {
+ return tool->impl == &tool_impl;
+}
+
struct wlr_libinput_tablet_tool {
struct wlr_tablet_tool_tool wlr_tool;
@@ -45,7 +51,8 @@ static void destroy_tool_tool(struct wlr_libinput_tablet_tool *tool) {
}
-static void libinput_tablet_tool_destroy(struct wlr_tablet_tool *tool) {
+static void destroy_tablet_tool(struct wlr_tablet_tool *tool) {
+ assert(tablet_tool_is_libinput(tool));
struct wlr_libinput_tablet *tablet =
wl_container_of(tool, tablet, wlr_tool);
@@ -65,7 +72,7 @@ static void libinput_tablet_tool_destroy(struct wlr_tablet_tool *tool) {
}
static struct wlr_tablet_tool_impl tool_impl = {
- .destroy = libinput_tablet_tool_destroy,
+ .destroy = destroy_tablet_tool,
};
struct wlr_tablet_tool *create_libinput_tablet_tool(
@@ -148,6 +155,7 @@ static struct wlr_libinput_tablet_tool *get_wlr_tablet_tool(
static void ensure_tool_reference(struct wlr_libinput_tablet_tool *tool,
struct wlr_tablet_tool *wlr_dev) {
+ assert(tablet_tool_is_libinput(wlr_dev));
struct tablet_tool_list_elem *pos;
struct wlr_libinput_tablet *tablet = wl_container_of(wlr_dev, tablet, wlr_tool);
@@ -271,6 +279,7 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
libinput_event_tablet_tool_get_proximity_state(tevent) == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) {
// The tool isn't unique, it can't be on multiple tablets
assert(tool->pad_refs == 1);
+ assert(tablet_tool_is_libinput(wlr_dev->tablet_tool));
struct wlr_libinput_tablet *tablet =
wl_container_of(wlr_dev->tablet_tool, tablet, wlr_tool);
struct tablet_tool_list_elem *pos;