From 43d27dae69da7c38f9a2ddcfe90b0125016842e7 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 1 May 2024 19:07:42 +0100 Subject: [PATCH] headers: add misc useful functions --- src/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 2d3765f..34c4f5d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -273,6 +273,26 @@ class {} {{ return pResource; }} + // get the client + wl_client* client() {{ + return wl_resource_get_client(pResource); + }} + + // send an error + void error(uint32_t error, const std::string& message) {{ + wl_resource_post_error(pResource, error, message.c_str()); + }} + + // send out of memory + void noMemory() {{ + wl_resource_post_no_memory(pResource); + }} + + // get the resource version + int version() {{ + return wl_resource_get_version(pResource); + }} + )#", IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL);