summaryrefslogtreecommitdiff
path: root/src/devices/Tablet.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-06-08 10:07:59 +0200
committerGitHub <noreply@github.com>2024-06-08 10:07:59 +0200
commit6967a31450441fc5605c05db6f65505dace4b263 (patch)
tree255a3cff7f3e2eb8a50c952eab9b270a7937561d /src/devices/Tablet.cpp
parentc31d9ef4172452f6f219f91d9b87a24d91f0cf3a (diff)
wayland/core: move to new impl (#6268)
* wayland/core/dmabuf: move to new impl it's the final countdown
Diffstat (limited to 'src/devices/Tablet.cpp')
-rw-r--r--src/devices/Tablet.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/devices/Tablet.cpp b/src/devices/Tablet.cpp
index f5b610a9..b5ab16c1 100644
--- a/src/devices/Tablet.cpp
+++ b/src/devices/Tablet.cpp
@@ -1,6 +1,7 @@
#include "Tablet.hpp"
#include "../defines.hpp"
#include "../protocols/Tablet.hpp"
+#include "../protocols/core/Compositor.hpp"
SP<CTablet> CTablet::create(wlr_tablet* tablet) {
SP<CTablet> pTab = SP<CTablet>(new CTablet(tablet));
@@ -295,32 +296,29 @@ CTabletTool::~CTabletTool() {
void CTabletTool::disconnectCallbacks() {
hyprListener_destroy.removeCallback();
- hyprListener_destroySurface.removeCallback();
+ listeners.destroySurface.reset();
}
-wlr_surface* CTabletTool::getSurface() {
- return pSurface;
+SP<CWLSurfaceResource> CTabletTool::getSurface() {
+ return pSurface.lock();
}
-void CTabletTool::setSurface(wlr_surface* surf) {
+void CTabletTool::setSurface(SP<CWLSurfaceResource> surf) {
if (surf == pSurface)
return;
if (pSurface) {
- hyprListener_destroySurface.removeCallback();
- pSurface = nullptr;
+ listeners.destroySurface.reset();
+ pSurface.reset();
}
pSurface = surf;
if (surf) {
- hyprListener_destroySurface.initCallback(
- &surf->events.destroy,
- [this](void* owner, void* data) {
- PROTO::tablet->proximityOut(self.lock());
- pSurface = nullptr;
- hyprListener_destroySurface.removeCallback();
- },
- this, "CTabletTool");
+ listeners.destroySurface = surf->events.destroy.registerListener([this](std::any d) {
+ PROTO::tablet->proximityOut(self.lock());
+ pSurface.reset();
+ listeners.destroySurface.reset();
+ });
}
}