From 6967a31450441fc5605c05db6f65505dace4b263 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sat, 8 Jun 2024 10:07:59 +0200 Subject: wayland/core: move to new impl (#6268) * wayland/core/dmabuf: move to new impl it's the final countdown --- src/devices/Tablet.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/devices/Tablet.cpp') 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::create(wlr_tablet* tablet) { SP pTab = SP(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 CTabletTool::getSurface() { + return pSurface.lock(); } -void CTabletTool::setSurface(wlr_surface* surf) { +void CTabletTool::setSurface(SP 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(); + }); } } -- cgit v1.2.3