Compare commits
11 Commits
upstream/0
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
9606635565 | |
|
|
092820f30d | |
|
|
95d26cd408 | |
|
|
f6dbe63aff | |
|
|
fc399d482a | |
|
|
bd888c80ac | |
|
|
59a128c953 | |
|
|
75628269f9 | |
|
|
c0855a23fb | |
|
|
92695e1c1e | |
|
|
d87d65b9d5 |
|
|
@ -1,6 +1,9 @@
|
|||
# hyprwayland-scanner
|
||||
A Hyprland implementation of wayland-scanner, in and for C++.
|
||||
|
||||
hw-s automatically generates properly RAII-ready, modern C++ bindings for Wayland protocols, for
|
||||
either servers or clients.
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
hyprwayland-scanner (0.4.4-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version 0.4.4
|
||||
|
||||
-- Alan M Varghese (NyxTrail) <alan@digistorm.in> Sun, 02 Mar 2025 10:20:41 +0000
|
||||
|
||||
hyprwayland-scanner (0.4.2-2) unstable; urgency=medium
|
||||
|
||||
* #1085254 : Mark 'Multi-Arch: foreign', and move pkgconf
|
||||
and cmake files to /usr/share
|
||||
|
||||
-- Alan M Varghese (NyxTrail) <alan@digistorm.in> Sat, 19 Oct 2024 13:39:08 +0000
|
||||
|
||||
hyprwayland-scanner (0.4.2-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version 0.4.2
|
||||
|
||||
-- Alan M Varghese (NyxTrail) <alan@digistorm.in> Sun, 22 Sep 2024 09:08:26 +0000
|
||||
|
||||
hyprwayland-scanner (0.3.10-1) unstable; urgency=medium
|
||||
|
||||
* Initial release. (Closes: #1073195)
|
||||
|
||||
-- Alan M Varghese (NyxTrail) <alan@digistorm.in> Fri, 14 Jun 2024 10:21:06 +0000
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
Source: hyprwayland-scanner
|
||||
Section: libdevel
|
||||
Priority: optional
|
||||
Maintainer: Alan M Varghese (NyxTrail) <alan@digistorm.in>
|
||||
Rules-Requires-Root: no
|
||||
Build-Depends:
|
||||
debhelper-compat (= 13),
|
||||
cmake,
|
||||
libpugixml-dev,
|
||||
pkgconf
|
||||
Standards-Version: 4.7.2
|
||||
Homepage: https://github.com/hyprwm/hyprwayland-scanner
|
||||
Vcs-Browser: https://salsa.debian.org/NyxTrail/hyprwayland-scanner
|
||||
Vcs-Git: https://salsa.debian.org/NyxTrail/hyprwayland-scanner.git
|
||||
|
||||
Package: hyprwayland-scanner
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends:
|
||||
${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
Description: Implementation of wayland-scanner for Hyprland
|
||||
hyprwayland-scanner is a Hyprland implementation of wayland-scanner,
|
||||
in and for C++.
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Source: https://github.com/hyprwm/hyprwayland-scanner
|
||||
Upstream-Name: hyprwayland-scanner
|
||||
Upstream-Contact: vaxerski <vaxry@vaxry.net>
|
||||
|
||||
Files:
|
||||
*
|
||||
Copyright:
|
||||
2024 Hypr Development
|
||||
License: BSD-3-Clause
|
||||
|
||||
Files:
|
||||
debian/*
|
||||
Copyright:
|
||||
2024-2025 Alan M Varghese (NyxTrail) <alan@digistorm.in>
|
||||
License: BSD-3-Clause
|
||||
|
||||
License: BSD-3-Clause
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
.
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
# export DH_VERBOSE = 1
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
||||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- \
|
||||
-DCMAKE_INSTALL_LIBDIR=/usr/share
|
||||
|
|
@ -0,0 +1 @@
|
|||
3.0 (quilt)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Bug-Database: https://github.com/hyprwm/hyprwayland-scanner/issues
|
||||
Bug-Submit: https://github.com/hyprwm/hyprwayland-scanner/issues/new
|
||||
Repository-Browse: https://github.com/hyprwm/hyprwayland-scanner
|
||||
Repository: https://github.com/hyprwm/hyprwayland-scanner.git
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
version=4
|
||||
opts="searchmode=html" \
|
||||
https://github.com/hyprwm/hyprwayland-scanner/tags \
|
||||
https://github.com/hyprwm/hyprwayland-scanner/archive/refs/tags/v(\d+)\.(\d+)\.(\d+)?\.tar\.gz
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1721138476,
|
||||
"narHash": "sha256-+W5eZOhhemLQxelojLxETfbFbc19NWawsXBlapYpqIA=",
|
||||
"lastModified": 1734119587,
|
||||
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ad0b5eed1b6031efaed382844806550c3dcb4206",
|
||||
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
default = self.overlays.hyprwayland-scanner;
|
||||
hyprwayland-scanner = final: prev: {
|
||||
hyprwayland-scanner = final.callPackage ./nix/default.nix {
|
||||
stdenv = final.gcc13Stdenv;
|
||||
stdenv = final.gcc14Stdenv;
|
||||
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
|
||||
};
|
||||
};
|
||||
|
|
|
|||
37
src/main.cpp
37
src/main.cpp
|
|
@ -47,6 +47,10 @@ struct {
|
|||
std::vector<SEnum> enums;
|
||||
} XMLDATA;
|
||||
|
||||
const char* resourceName() {
|
||||
return clientCode ? "wl_proxy" : "wl_resource";
|
||||
}
|
||||
|
||||
std::string sanitize(const std::string& in) {
|
||||
if (in == "namespace")
|
||||
return "namespace_";
|
||||
|
|
@ -124,7 +128,7 @@ std::string WPTypeToCType(const SRequestArgument& arg, bool event /* events pass
|
|||
if (i.name == arg.interface)
|
||||
return camelize((clientCode ? "CC_" : "C_") + arg.interface + "*");
|
||||
}
|
||||
return "wl_resource*";
|
||||
return std::string{resourceName()} + "*";
|
||||
}
|
||||
|
||||
return "uint32_t";
|
||||
|
|
@ -136,7 +140,7 @@ std::string WPTypeToCType(const SRequestArgument& arg, bool event /* events pass
|
|||
return camelize((clientCode ? "CC_" : "C_") + arg.interface + "*");
|
||||
}
|
||||
}
|
||||
return "wl_resource*";
|
||||
return std::string{resourceName()} + "*";
|
||||
}
|
||||
if (arg.wlType == "int" || arg.wlType == "fd")
|
||||
return "int32_t";
|
||||
|
|
@ -241,7 +245,8 @@ void parseXML(pugi::xml_document& doc) {
|
|||
void parseHeader() {
|
||||
|
||||
// add some boilerplate
|
||||
HEADER += std::format(R"#(#pragma once
|
||||
HEADER +=
|
||||
std::format(R"#(#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
|
|
@ -253,8 +258,7 @@ void parseHeader() {
|
|||
{}
|
||||
|
||||
)#",
|
||||
(clientCode ? "#include <wayland-client.h>" : "#include <wayland-server.h>"),
|
||||
(clientCode ? "struct wl_proxy;\ntypedef wl_proxy wl_resource;" : "struct wl_client;\nstruct wl_resource;"));
|
||||
(clientCode ? "#include <wayland-client.h>" : "#include <wayland-server.h>"), (clientCode ? "struct wl_proxy;" : "struct wl_client;\nstruct wl_resource;"));
|
||||
|
||||
// parse all enums
|
||||
if (!waylandEnums) {
|
||||
|
|
@ -324,7 +328,7 @@ class {} {{
|
|||
~{}();
|
||||
|
||||
)#",
|
||||
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, (clientCode ? "wl_resource*" : "wl_client* client, uint32_t version, uint32_t id"), IFACE_CLASS_NAME_CAMEL);
|
||||
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, (clientCode ? "wl_proxy*" : "wl_client* client, uint32_t version, uint32_t id"), IFACE_CLASS_NAME_CAMEL);
|
||||
|
||||
if (!clientCode) {
|
||||
HEADER += std::format(R"#(
|
||||
|
|
@ -382,7 +386,12 @@ class {} {{
|
|||
}}
|
||||
|
||||
// get the raw wl_resource (wl_proxy) ptr
|
||||
wl_resource* resource() {{
|
||||
wl_proxy* resource() {{
|
||||
return pResource;
|
||||
}}
|
||||
|
||||
// get the raw wl_proxy ptr
|
||||
wl_proxy* proxy() {{
|
||||
return pResource;
|
||||
}}
|
||||
|
||||
|
|
@ -493,7 +502,7 @@ class {} {{
|
|||
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL);
|
||||
} else {
|
||||
HEADER += R"#(
|
||||
wl_resource* pResource = nullptr;
|
||||
wl_proxy* pResource = nullptr;
|
||||
|
||||
bool destroyed = false;
|
||||
|
||||
|
|
@ -675,8 +684,8 @@ static const void* {}[] = {{
|
|||
std::string argsN = ", ";
|
||||
for (auto& arg : ev.args) {
|
||||
if (arg.newType)
|
||||
continue;
|
||||
if (!WPTypeToCType(arg, true).starts_with("C"))
|
||||
argsN += "nullptr, ";
|
||||
else if (!WPTypeToCType(arg, true).starts_with("C"))
|
||||
argsN += arg.name + ", ";
|
||||
else
|
||||
argsN += (arg.name + " ? " + arg.name + "->pResource : nullptr, ");
|
||||
|
|
@ -703,12 +712,12 @@ void {}::{}({}) {{
|
|||
if (!pResource)
|
||||
return{};{}
|
||||
|
||||
auto proxy = wl_proxy_marshal_flags((wl_proxy*)pResource, {}, {}, wl_proxy_get_version((wl_proxy*)pResource), {}{}{});{}
|
||||
auto proxy = wl_proxy_marshal_flags((wl_proxy*)pResource, {}, {}, wl_proxy_get_version((wl_proxy*)pResource), {}{});{}
|
||||
}}
|
||||
)#",
|
||||
ptrRetType, IFACE_CLASS_NAME_CAMEL, EVENT_NAME, argsC, (ev.newIdType.empty() ? "" : " nullptr"),
|
||||
(ev.destructor ? "\n destroyed = true;" : ""), evid, (ev.newIdType.empty() ? "nullptr" : "&" + ev.newIdType + "_interface"), flags,
|
||||
(!ev.newIdType.empty() ? ", nullptr" : ""), argsN, (ev.newIdType.empty() ? "\n proxy;" : "\n\n return proxy;"));
|
||||
(ev.destructor ? "\n destroyed = true;" : ""), evid, (ev.newIdType.empty() ? "nullptr" : "&" + ev.newIdType + "_interface"), flags, argsN,
|
||||
(ev.newIdType.empty() ? "\n proxy;" : "\n\n return proxy;"));
|
||||
}
|
||||
|
||||
evid++;
|
||||
|
|
@ -903,7 +912,7 @@ void {}::onDestroyCalled() {{
|
|||
DTOR_FUNC = "wl_proxy_destroy(pResource)";
|
||||
|
||||
SOURCE += std::format(R"#(
|
||||
{}::{}(wl_resource* resource) {{
|
||||
{}::{}(wl_proxy* resource) {{
|
||||
pResource = resource;
|
||||
|
||||
if (!pResource)
|
||||
|
|
|
|||
Loading…
Reference in New Issue