Compare commits

...

9 commits
v0.4.4 ... main

Author SHA1 Message Date
SASANO Takayoshi
f6cf414ca0
cmake: add OpenBSD support (no librt) (#21) 2025-11-20 12:04:34 +00:00
Martin
b3b0f1f40a
source: Generate protocol specific dummy_type names (#20) 2025-08-14 16:16:42 +01:00
fcca0c61f9
version: bump to 0.4.5 2025-07-07 16:18:29 +02:00
8fb426b3e5
server: fix empty interface arrays 2025-07-07 11:44:32 +02:00
aa38edd6e3
CI/Nix: add cache-nix-action
Use nixbuild/nix-quick-install-action which pairs well with
nix-community/cache-nix-action.

Should help with build times by reducing the number of packages needing
to be re-downloaded on each run.

Parameters are taken from https://github.com/nix-community/cache-nix-action
and may be tweaked later.
2025-06-20 01:24:29 +03:00
Friday
817918315e
nix: use gcc15 (#17)
also updated dependencies
2025-06-05 18:49:20 +01:00
NyxTrail
e511882b9c
cmake: Make CMAKE builds arch independent (#16) 2025-05-18 18:04:58 +02:00
Honkazel
206367a08d
core: member + designated init and remove redundant cast (#14)
* core: member initialize and rm redundant cast

Both pResource can be member initialized and cast is redundant since 4a53f1a

* use designated initializers
2025-02-18 10:21:20 +01:00
04146df74a
CI: remove deprecated magic-nix-cache-action 2025-02-08 23:10:28 +02:00
6 changed files with 63 additions and 22 deletions

View file

@ -7,8 +7,35 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v25
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v31
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago
purge-created: 0
# or, last accessed more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-last-accessed: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
# not needed (yet)
# - uses: cachix/cachix-action@v12

View file

@ -41,7 +41,13 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET pugixml)
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(hyprwayland-scanner ${SRCFILES})
target_link_libraries(hyprwayland-scanner PRIVATE rt Threads::Threads
find_library(librt rt)
if("${librt}" MATCHES "librt-NOTFOUND")
unset(LIBRT)
else()
set(LIBRT rt)
endif()
target_link_libraries(hyprwayland-scanner PRIVATE ${LIBRT} Threads::Threads
PkgConfig::deps)
configure_package_config_file(
@ -51,6 +57,7 @@ configure_package_config_file(
write_basic_package_version_file(
"hyprwayland-scanner-config-version.cmake"
VERSION "${VERSION}"
ARCH_INDEPENDENT
COMPATIBILITY AnyNewerVersion)
# Installation

View file

@ -1 +1 @@
0.4.4
0.4.5

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1734119587,
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
"lastModified": 1748929857,
"narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
"rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
"type": "github"
},
"original": {

View file

@ -36,7 +36,7 @@
default = self.overlays.hyprwayland-scanner;
hyprwayland-scanner = final: prev: {
hyprwayland-scanner = final.callPackage ./nix/default.nix {
stdenv = final.gcc14Stdenv;
stdenv = final.gcc15Stdenv;
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};

View file

@ -516,6 +516,8 @@ class {} {{
}
void parseSource() {
std::string DUMMY_TYPE_TABLE_NAME = PROTO_DATA.name + "_dummyTypes";
SOURCE += std::format(R"#(#define private public
#define HYPRWAYLAND_SCANNER_NO_INTERFACES
#include "{}.hpp"
@ -527,9 +529,9 @@ void parseSource() {
// reference interfaces
// dummy
SOURCE += R"#(
static const wl_interface* dummyTypes[] = { nullptr };
)#";
SOURCE += std::format(R"#(
static const wl_interface* {}[] = {{ nullptr }};
)#", DUMMY_TYPE_TABLE_NAME);
SOURCE += R"#(
// Reference all other interfaces.
@ -661,6 +663,10 @@ static const void* {}[] = {{
SOURCE += std::format(" (void*){},\n", REQUEST_NAME);
}
if ((clientCode ? iface.events : iface.requests).empty()) {
SOURCE += " nullptr,\n";
}
SOURCE += "};\n";
// create events
@ -712,7 +718,7 @@ 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(pResource, {}, {}, wl_proxy_get_version(pResource), {}{});{}
}}
)#",
ptrRetType, IFACE_CLASS_NAME_CAMEL, EVENT_NAME, argsC, (ev.newIdType.empty() ? "" : " nullptr"),
@ -818,7 +824,8 @@ static const wl_message {}[] = {{
// create type table
const auto TYPE_TABLE_NAME = camelize(std::string{"_"} + "C_" + IFACE_NAME + "_" + rq.name + "_types");
SOURCE += std::format(" {{ \"{}\", \"{}\", {}}},\n", rq.name, argsToShort(rq.args, rq.since), rq.args.empty() ? "dummyTypes + 0" : TYPE_TABLE_NAME + " + 0");
SOURCE += std::format(" {{ .name = \"{}\", .signature = \"{}\", .types = {}}},\n", rq.name, argsToShort(rq.args, rq.since),
rq.args.empty() ? std::format("{} + 0", DUMMY_TYPE_TABLE_NAME) : TYPE_TABLE_NAME + " + 0");
}
SOURCE += "};\n";
@ -833,7 +840,8 @@ static const wl_message {}[] = {{
// create type table
const auto TYPE_TABLE_NAME = camelize(std::string{"_"} + "C_" + IFACE_NAME + "_" + ev.name + "_types");
SOURCE += std::format(" {{ \"{}\", \"{}\", {}}},\n", ev.name, argsToShort(ev.args, ev.since), ev.args.empty() ? "dummyTypes + 0" : TYPE_TABLE_NAME + " + 0");
SOURCE += std::format(" {{ .name = \"{}\", .signature = \"{}\", .types = {}}},\n", ev.name, argsToShort(ev.args, ev.since),
ev.args.empty() ? std::format("{} + 0", DUMMY_TYPE_TABLE_NAME) : TYPE_TABLE_NAME + " + 0");
}
SOURCE += "};\n";
@ -842,9 +850,9 @@ static const wl_message {}[] = {{
// iface
SOURCE += std::format(R"#(
const wl_interface {} = {{
"{}", {},
{}, {},
{}, {},
.name = "{}", .version = {},
.method_count = {}, .methods = {},
.event_count = {}, .events = {},
}};
)#",
IFACE_WL_NAME, iface.name, iface.version, iface.requests.size(), (iface.requests.size() > 0 ? MESSAGE_NAME_REQUESTS : "nullptr"),
@ -854,8 +862,8 @@ const wl_interface {} = {{
// protocol body
if (!clientCode) {
SOURCE += std::format(R"#(
{}::{}(wl_client* client, uint32_t version, uint32_t id) {{
pResource = wl_resource_create(client, &{}, version, id);
{}::{}(wl_client* client, uint32_t version, uint32_t id) :
pResource(wl_resource_create(client, &{}, version, id)) {{
if (!pResource)
return;
@ -912,8 +920,7 @@ void {}::onDestroyCalled() {{
DTOR_FUNC = "wl_proxy_destroy(pResource)";
SOURCE += std::format(R"#(
{}::{}(wl_proxy* resource) {{
pResource = resource;
{}::{}(wl_proxy* resource) : pResource(resource) {{
if (!pResource)
return;