Commit 0bf6fc6a authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

tablet: Address how he clean resources up

parent 1c0a103b
......@@ -185,15 +185,15 @@ public:
void zwp_tablet_tool_v2_destroy_resource(Resource * resource) override {
delete m_cursors.take(resource->handle);
}
void zwp_tablet_tool_v2_destroy(Resource *resource) override {
Q_UNUSED(resource);
if (m_removed && resourceMap().isEmpty()) {
delete q;
}
}
void zwp_tablet_tool_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
}
Display *const m_display;
bool m_cleanup = false;
bool m_removed = false;
......@@ -349,12 +349,16 @@ public:
return r ? r->handle : nullptr;
}
void zwp_tablet_pad_ring_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
void zwp_tablet_pad_ring_v2_destroy_resource(Resource *resource) override {
Q_UNUSED(resource)
if (m_pad->isRemoved() && resourceMap().isEmpty()) {
delete q;
}
}
void zwp_tablet_pad_ring_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
}
TabletPadRingV2Interface *const q;
TabletPadV2Interface *m_pad;
};
......@@ -403,12 +407,16 @@ public:
return r ? r->handle : nullptr;
}
void zwp_tablet_pad_strip_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
void zwp_tablet_pad_strip_v2_destroy_resource(Resource *resource) override {
Q_UNUSED(resource)
if (m_pad->isRemoved() && resourceMap().isEmpty()) {
delete q;
}
}
void zwp_tablet_pad_strip_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
}
TabletPadV2Interface *m_pad = nullptr;
TabletPadStripV2Interface *const q;
};
......@@ -458,13 +466,17 @@ public:
return r ? r->handle : nullptr;
}
void zwp_tablet_pad_group_v2_destroy(Resource * resource) override {
wl_resource_destroy(resource->handle);
void zwp_tablet_pad_group_v2_destroy_resource(Resource *resource) override {
Q_UNUSED(resource)
if (m_pad->isRemoved() && resourceMap().isEmpty()) {
delete q;
}
}
void zwp_tablet_pad_group_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
}
TabletPadGroupV2Interface *const q;
TabletPadV2Interface *m_pad = nullptr;
quint32 m_currentMode;
......@@ -514,13 +526,17 @@ public:
}
}
void zwp_tablet_pad_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
void zwp_tablet_pad_v2_destroy_resource(Resource *resource) override {
Q_UNUSED(resource)
if (m_removed && resourceMap().isEmpty()) {
delete q;
}
}
void zwp_tablet_pad_v2_destroy(Resource *resource) override {
wl_resource_destroy(resource->handle);
}
void zwp_tablet_pad_v2_set_feedback(Resource *resource, quint32 button, const QString &description, quint32 serial) override {
Q_EMIT q->feedback(m_display->getConnection(resource->client()), button, description, serial);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment