From 6fdc0ceac9c7288a8f8ff38d64c2be4b3be66ef7 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 29 May 2024 22:31:08 +0200 Subject: [PATCH] core: fix external type usage --- src/main.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0a307a3..7a1345b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -115,8 +115,13 @@ std::string WPTypeToCType(const SRequestArgument& arg, bool event /* events pass } // iface - if (!arg.interface.empty() && event) - return camelize("C_" + arg.interface + "*"); + if (!arg.interface.empty() && event) { + for (auto& i : XMLDATA.ifaces) { + if (i.name == arg.interface) + return camelize("C_" + arg.interface + "*"); + } + return "wl_resource*"; + } return "uint32_t"; } @@ -255,7 +260,7 @@ struct wl_resource; for (auto& iface : XMLDATA.ifaces) { const auto IFACE_CLASS_NAME_CAMEL = camelize("C_" + iface.name); HEADER += std::format("\nclass {};", IFACE_CLASS_NAME_CAMEL); - + for (auto& rq : iface.requests) { for (auto& arg : rq.args) { if (!arg.interface.empty()) { @@ -372,7 +377,7 @@ class {} {{ HEADER += std::format(" void {}({});\n", camelize("send_" + ev.name), args); } - // dangerous ones + // dangerous ones for (auto& ev : iface.events) { std::string args = ""; for (auto& arg : ev.args) {