summaryrefslogtreecommitdiff
path: root/src/protocols/WaylandProtocol.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-04-19 22:16:35 +0100
committerGitHub <noreply@github.com>2024-04-19 22:16:35 +0100
commitb52a49b4c4c344784b3085cb93d3882d3ce9b4bb (patch)
treea8c3ab6cf77cec5e22565f0f2a3adacfaa6edf30 /src/protocols/WaylandProtocol.hpp
parent1016faea53fd2d6a9bc12340425230b84676d7cd (diff)
tearing-control: hyprland impl (#5655)
* tearing: hl impl * format
Diffstat (limited to 'src/protocols/WaylandProtocol.hpp')
-rw-r--r--src/protocols/WaylandProtocol.hpp20
1 files changed, 15 insertions, 5 deletions
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 <functional>
+
#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<void(CWaylandResource* res)> 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<void(CWaylandResource* res)> m_fOnDestroyHandler;
};
class IWaylandProtocol {