From b52a49b4c4c344784b3085cb93d3882d3ce9b4bb Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 19 Apr 2024 22:16:35 +0100 Subject: tearing-control: hyprland impl (#5655) * tearing: hl impl * format --- src/protocols/WaylandProtocol.hpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/protocols/WaylandProtocol.hpp') diff --git a/src/protocols/WaylandProtocol.hpp b/src/protocols/WaylandProtocol.hpp index a87bd519..cc8a0e53 100644 --- a/src/protocols/WaylandProtocol.hpp +++ b/src/protocols/WaylandProtocol.hpp @@ -2,11 +2,18 @@ #include "../defines.hpp" +#include + #define RESOURCE_OR_BAIL(resname) \ const auto resname = (CWaylandResource*)wl_resource_get_user_data(resource); \ if (!resname) \ return; +#define SP std::shared_ptr +#define UP std::unique_ptr + +#define PROTO NProtocols + class CWaylandResource { public: CWaylandResource(wl_client* client, const wl_interface* wlInterface, uint32_t version, uint32_t id); @@ -24,12 +31,15 @@ class CWaylandResource { void* data(); void setData(void* data); + void setOnDestroyHandler(std::function fn); + private: - bool m_bImplementationSet = false; - bool m_bDefunct = false; // m_liResourceDestroy fired - wl_client* m_pWLClient = nullptr; - wl_resource* m_pWLResource = nullptr; - void* m_pData = nullptr; + bool m_bImplementationSet = false; + bool m_bDefunct = false; // m_liResourceDestroy fired + wl_client* m_pWLClient = nullptr; + wl_resource* m_pWLResource = nullptr; + void* m_pData = nullptr; + std::function m_fOnDestroyHandler; }; class IWaylandProtocol { -- cgit v1.2.3