* [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar
@ 2024-03-23 22:38 cinerea0
2024-04-03 3:39 ` Luciogi
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: cinerea0 @ 2024-03-23 22:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
There is a new pull request by cinerea0 against master on the void-packages repository
https://github.com/cinerea0/void-packages wireplumber
https://github.com/void-linux/void-packages/pull/49490
wireplumber: update to 0.5.0; revbump Waybar
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/49490.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-wireplumber-49490.patch --]
[-- Type: text/x-diff, Size: 23939 bytes --]
From c3a5b2e20acca4b0211e1253a300a5bbcdb35de4 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Fri, 22 Mar 2024 21:46:23 -0400
Subject: [PATCH 1/2] wireplumber: update to 0.5.0
---
common/shlibs | 2 +-
srcpkgs/wireplumber/patches/test.patch | 16 ++++++++--------
srcpkgs/wireplumber/template | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/common/shlibs b/common/shlibs
index a60c03a1473078..48d59d3ec7d1d3 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4259,7 +4259,7 @@ libayatana-ido3-0.4.so.0 ayatana-ido-0.9.2_1
libayatana-indicator3.so.7 libayatana-indicator-0.9.3_1
libayatana-appindicator3.so.1 libayatana-appindicator-0.5.91_1
libplayerctl.so.2 playerctl-2.4.1_1
-libwireplumber-0.4.so.0 wireplumber-0.4.14_1
+libwireplumber-0.5.so.0 wireplumber-0.5.0_1
libjodycode.so.3 libjodycode-3.0.1_1
libgsoapssl++-2.8.124.so gsoap-2.8.124_1
libjxl.so.0.10 libjxl-0.10.0_1
diff --git a/srcpkgs/wireplumber/patches/test.patch b/srcpkgs/wireplumber/patches/test.patch
index 2340b3acad409e..590fa7ebc67b0b 100644
--- a/srcpkgs/wireplumber/patches/test.patch
+++ b/srcpkgs/wireplumber/patches/test.patch
@@ -7,17 +7,17 @@ https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/18
Also remove two other failing tests.
diff --git a/tests/modules/meson.build b/tests/modules/meson.build
-index 4b4d1bd..3385e4e 100644
+index f3f694e641f..994b4a45706 100644
--- a/tests/modules/meson.build
+++ b/tests/modules/meson.build
-@@ -24,13 +24,6 @@ test(
+@@ -26,13 +26,6 @@ test(
env: common_env,
)
-test(
- 'test-si-node',
- executable('test-si-node', 'si-node.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
@@ -25,31 +25,31 @@ index 4b4d1bd..3385e4e 100644
'test-si-audio-adapter',
executable('test-si-audio-adapter', 'si-audio-adapter.c',
diff --git a/tests/wp/meson.build b/tests/wp/meson.build
-index a18caf7..4df6ca6 100644
+index cc0b9ac85b0..360f39b2555 100644
--- a/tests/wp/meson.build
+++ b/tests/wp/meson.build
-@@ -34,13 +34,6 @@ test(
+@@ -38,13 +38,6 @@ test(
env: common_env,
)
-test(
- 'test-object-manager',
- executable('test-object-manager', 'object-manager.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
test(
'test-properties',
executable('test-properties', 'properties.c',
-@@ -48,13 +41,6 @@ test(
+@@ -52,13 +45,6 @@ test(
env: common_env,
)
-test(
- 'test-proxy',
- executable('test-proxy', 'proxy.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
diff --git a/srcpkgs/wireplumber/template b/srcpkgs/wireplumber/template
index 4ce4f959590ef2..c729edef433709 100644
--- a/srcpkgs/wireplumber/template
+++ b/srcpkgs/wireplumber/template
@@ -1,6 +1,6 @@
# Template file for 'wireplumber'
pkgname=wireplumber
-version=0.4.17
+version=0.5.0
revision=1
build_style=meson
build_helper=gir
@@ -14,7 +14,7 @@ license="MIT"
homepage="https://pipewire.pages.freedesktop.org/wireplumber"
changelog="https://gitlab.freedesktop.org/pipewire/wireplumber/-/raw/master/NEWS.rst"
distfiles="https://gitlab.freedesktop.org/pipewire/wireplumber/-/archive/$version/wireplumber-$version.tar.gz"
-checksum=a12534fd9c1ecf9fbc09f79192d9d57c9ab7bf01da82615ab4103b2f8e2e91a7
+checksum=809d602df0454090396a5e51e1392b46781c560a1f4ae1020537f2726dd6a1a1
provides="pipewire-session-manager-0_1"
post_install() {
From 89db42df64f349b9bbc7f8d1761caf39b32c862c Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Fri, 22 Mar 2024 21:46:55 -0400
Subject: [PATCH 2/2] Waybar: revbump for wireplumber-0.5
---
srcpkgs/Waybar/patches/wireplumber-0.5.patch | 419 +++++++++++++++++++
srcpkgs/Waybar/template | 2 +-
2 files changed, 420 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/Waybar/patches/wireplumber-0.5.patch
diff --git a/srcpkgs/Waybar/patches/wireplumber-0.5.patch b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
new file mode 100644
index 00000000000000..d6399a62c3aa9c
--- /dev/null
+++ b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
@@ -0,0 +1,419 @@
+From 2326727ccbf0456ccfd631e748955f7f67c44a4e Mon Sep 17 00:00:00 2001
+From: Ryan Walklin <ryan@testtoast.com>
+Date: Thu, 15 Feb 2024 09:37:36 +1300
+Subject: [PATCH] Update Wireplumber API to 0.5
+
+The WP component loader API has changed to be asynchronous, so implement a (GAsyncReadyCallback)-based loader to manage them. Logging integration change was required for 0.5.0 RCs but not for the 0.5.0 release.
+
+Fix clang-tidy and clang-format warnings. Note these are significantly wider than the changes for 0.5.0 so optional beyond the existing patchset.
+---
+ include/modules/wireplumber.hpp | 5 +-
+ meson.build | 2 +-
+ src/modules/wireplumber.cpp | 190 ++++++++++++++++++--------------
+ 3 files changed, 115 insertions(+), 82 deletions(-)
+
+diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
+index 9bbf4d464..6255b95fd 100644
+--- a/include/modules/wireplumber.hpp
++++ b/include/modules/wireplumber.hpp
+@@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
+ auto update() -> void override;
+
+ private:
+- void loadRequiredApiModules();
++ void asyncLoadRequiredApiModules();
+ void prepare();
+ void activatePlugins();
+ static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
+ static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
++ static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self);
++ static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
+ static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
+ static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
+diff --git a/meson.build b/meson.build
+index e21ff262c..120976083 100644
+--- a/meson.build
++++ b/meson.build
+@@ -92,7 +92,7 @@ libevdev = dependency('libevdev', required: get_option('libevdev'))
+ libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
+ xkbregistry = dependency('xkbregistry')
+ libjack = dependency('jack', required: get_option('jack'))
+-libwireplumber = dependency('wireplumber-0.4', required: get_option('wireplumber'))
++libwireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
+
+ libsndio = compiler.find_library('sndio', required: get_option('sndio'))
+ if libsndio.found()
+diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
+index 51bb708d1..bd019b623 100644
+--- a/src/modules/wireplumber.cpp
++++ b/src/modules/wireplumber.cpp
+@@ -18,31 +18,24 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
+ min_step_(0.0),
+ node_id_(0) {
+ wp_init(WP_INIT_PIPEWIRE);
+- wp_core_ = wp_core_new(NULL, NULL);
++ wp_core_ = wp_core_new(nullptr, nullptr, nullptr);
+ apis_ = g_ptr_array_new_with_free_func(g_object_unref);
+ om_ = wp_object_manager_new();
+
+ prepare();
+
+- loadRequiredApiModules();
++ spdlog::debug("[{}]: connecting to pipewire...", name_);
+
+- spdlog::debug("[{}]: connecting to pipewire...", this->name_);
+-
+- if (!wp_core_connect(wp_core_)) {
+- spdlog::error("[{}]: Could not connect to PipeWire", this->name_);
++ if (wp_core_connect(wp_core_) == 0) {
++ spdlog::error("[{}]: Could not connect to PipeWire", name_);
+ throw std::runtime_error("Could not connect to PipeWire\n");
+ }
+
+- spdlog::debug("[{}]: connected!", this->name_);
++ spdlog::debug("[{}]: connected!", name_);
+
+ g_signal_connect_swapped(om_, "installed", (GCallback)onObjectManagerInstalled, this);
+
+- activatePlugins();
+-
+- dp.emit();
+-
+- event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
+- event_box_.signal_scroll_event().connect(sigc::mem_fun(*this, &Wireplumber::handleScroll));
++ asyncLoadRequiredApiModules();
+ }
+
+ waybar::modules::Wireplumber::~Wireplumber() {
+@@ -63,32 +56,36 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
+ return;
+ }
+
+- auto proxy = static_cast<WpProxy*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_GLOBAL_PROXY, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ auto* proxy = static_cast<WpProxy*>(wp_object_manager_lookup(self->om_, WP_TYPE_GLOBAL_PROXY,
++ WP_CONSTRAINT_TYPE_G_PROPERTY,
++ "bound-id", "=u", id, nullptr));
+
+- if (!proxy) {
++ if (proxy == nullptr) {
+ auto err = fmt::format("Object '{}' not found\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+ }
+
+ g_autoptr(WpProperties) properties =
+- WP_IS_PIPEWIRE_OBJECT(proxy) ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
+- : wp_properties_new_empty();
+- g_autoptr(WpProperties) global_p = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
++ WP_IS_PIPEWIRE_OBJECT(proxy) != 0
++ ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
++ : wp_properties_new_empty();
++ g_autoptr(WpProperties) globalP = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
+ properties = wp_properties_ensure_unique_owner(properties);
+- wp_properties_add(properties, global_p);
+- wp_properties_set(properties, "object.id", NULL);
+- auto nick = wp_properties_get(properties, "node.nick");
+- auto description = wp_properties_get(properties, "node.description");
+-
+- self->node_name_ = nick ? nick : description ? description : "Unknown node name";
++ wp_properties_add(properties, globalP);
++ wp_properties_set(properties, "object.id", nullptr);
++ const auto* nick = wp_properties_get(properties, "node.nick");
++ const auto* description = wp_properties_get(properties, "node.description");
++
++ self->node_name_ = nick != nullptr ? nick
++ : description != nullptr ? description
++ : "Unknown node name";
+ spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_);
+ }
+
+ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* self, uint32_t id) {
+ spdlog::debug("[{}]: updating volume", self->name_);
+- GVariant* variant = NULL;
++ GVariant* variant = nullptr;
+
+ if (!isValidNodeId(id)) {
+ spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
+@@ -97,7 +94,7 @@ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* se
+
+ g_signal_emit_by_name(self->mixer_api_, "get-volume", id, &variant);
+
+- if (!variant) {
++ if (variant == nullptr) {
+ auto err = fmt::format("Node {} does not support volume\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+@@ -115,9 +112,9 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
+ return;
+ }
+@@ -140,49 +137,49 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
+ spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
+
+- uint32_t default_node_id;
+- g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id);
++ uint32_t defaultNodeId;
++ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &defaultNodeId);
+
+- if (!isValidNodeId(default_node_id)) {
++ if (!isValidNodeId(defaultNodeId)) {
+ spdlog::warn("[{}]: '{}' is not a valid node ID. Ignoring node change.", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(
+ wp_object_manager_lookup(self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id",
+- "=u", default_node_id, NULL));
++ "=u", defaultNodeId, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onDefaultNodesApiChanged) - Object with id {} not found", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+- const gchar* default_node_name =
++ const gchar* defaultNodeName =
+ wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name");
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - got the following default node: Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+- if (g_strcmp0(self->default_node_name_, default_node_name) == 0) {
++ if (g_strcmp0(self->default_node_name_, defaultNodeName) == 0) {
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node has not changed. Node(name: {}, id: {}). "
+ "Ignoring.",
+- self->name_, self->default_node_name_, default_node_id);
++ self->name_, self->default_node_name_, defaultNodeId);
+ return;
+ }
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node changed to -> Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+ g_free(self->default_node_name_);
+- self->default_node_name_ = g_strdup(default_node_name);
+- self->node_id_ = default_node_id;
+- updateVolume(self, default_node_id);
+- updateNodeName(self, default_node_id);
++ self->default_node_name_ = g_strdup(defaultNodeName);
++ self->node_id_ = defaultNodeId;
++ updateVolume(self, defaultNodeId);
++ updateNodeName(self, defaultNodeId);
+ }
+
+ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
+@@ -190,14 +187,14 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ self->def_nodes_api_ = wp_plugin_find(self->wp_core_, "default-nodes-api");
+
+- if (!self->def_nodes_api_) {
++ if (self->def_nodes_api_ == nullptr) {
+ spdlog::error("[{}]: default nodes api is not loaded.", self->name_);
+ throw std::runtime_error("Default nodes API is not loaded\n");
+ }
+
+ self->mixer_api_ = wp_plugin_find(self->wp_core_, "mixer-api");
+
+- if (!self->mixer_api_) {
++ if (self->mixer_api_ == nullptr) {
+ spdlog::error("[{}]: mixer api is not loaded.", self->name_);
+ throw std::runtime_error("Mixer api is not loaded\n");
+ }
+@@ -206,7 +203,7 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+ &self->default_node_name_);
+ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_);
+
+- if (self->default_node_name_) {
++ if (self->default_node_name_ != nullptr) {
+ spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
+ self->name_, self->default_node_name_, self->node_id_);
+ }
+@@ -221,11 +218,11 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
+ waybar::modules::Wireplumber* self) {
+- auto plugin_name = wp_plugin_get_name(WP_PLUGIN(p));
+- spdlog::debug("[{}]: onPluginActivated: {}", self->name_, plugin_name);
+- g_autoptr(GError) error = NULL;
++ const auto* pluginName = wp_plugin_get_name(WP_PLUGIN(p));
++ spdlog::debug("[{}]: onPluginActivated: {}", self->name_, pluginName);
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_object_activate_finish(p, res, &error)) {
++ if (wp_object_activate_finish(p, res, &error) == 0) {
+ spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
+ throw std::runtime_error(error->message);
+ }
+@@ -240,7 +237,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ for (uint16_t i = 0; i < apis_->len; i++) {
+ WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
+ pending_plugins_++;
+- wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, NULL,
++ wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, nullptr,
+ (GAsyncReadyCallback)onPluginActivated, this);
+ }
+ }
+@@ -248,34 +245,67 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ void waybar::modules::Wireplumber::prepare() {
+ spdlog::debug("[{}]: preparing object manager", name_);
+ wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
+- "=s", "Audio/Sink", NULL);
++ "=s", "Audio/Sink", nullptr);
+ }
+
+-void waybar::modules::Wireplumber::loadRequiredApiModules() {
+- spdlog::debug("[{}]: loading required modules", name_);
+- g_autoptr(GError) error = NULL;
++void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", NULL,
+- &error)) {
++ spdlog::debug("[{}]: callback loading default node api module", self->name_);
++
++ success = wp_core_load_component_finish(self->wp_core_, res, &error);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: default nodes API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
++ spdlog::debug("[{}]: loaded default nodes api", self->name_);
++ g_ptr_array_add(self->apis_, wp_plugin_find(self->wp_core_, "default-nodes-api"));
++
++ spdlog::debug("[{}]: loading mixer api module", self->name_);
++ wp_core_load_component(self->wp_core_, "libwireplumber-module-mixer-api", "module", nullptr,
++ "mixer-api", nullptr, (GAsyncReadyCallback)onMixerApiLoaded, self);
++}
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-mixer-api", "module", NULL,
+- &error)) {
++void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
++
++ success = wp_core_load_component_finish(self->wp_core_, res, nullptr);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: mixer API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
+
+- g_ptr_array_add(apis_, wp_plugin_find(wp_core_, "default-nodes-api"));
+- g_ptr_array_add(apis_, ({
+- WpPlugin* p = wp_plugin_find(wp_core_, "mixer-api");
+- g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, NULL);
++ spdlog::debug("[{}]: loaded mixer API", self->name_);
++ g_ptr_array_add(self->apis_, ({
++ WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
++ g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
+ p;
+ }));
++
++ self->activatePlugins();
++
++ self->dp.emit();
++
++ self->event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
++ self->event_box_.signal_scroll_event().connect(sigc::mem_fun(*self, &Wireplumber::handleScroll));
++}
++
++void waybar::modules::Wireplumber::asyncLoadRequiredApiModules() {
++ spdlog::debug("[{}]: loading default nodes api module", name_);
++ wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", nullptr,
++ "default-nodes-api", nullptr, (GAsyncReadyCallback)onDefaultNodesApiLoaded,
++ this);
+ }
+
+ auto waybar::modules::Wireplumber::update() -> void {
+ auto format = format_;
+- std::string tooltip_format;
++ std::string tooltipFormat;
+
+ if (muted_) {
+ format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
+@@ -292,12 +322,12 @@ auto waybar::modules::Wireplumber::update() -> void {
+ getState(vol);
+
+ if (tooltipEnabled()) {
+- if (tooltip_format.empty() && config_["tooltip-format"].isString()) {
+- tooltip_format = config_["tooltip-format"].asString();
++ if (tooltipFormat.empty() && config_["tooltip-format"].isString()) {
++ tooltipFormat = config_["tooltip-format"].asString();
+ }
+
+- if (!tooltip_format.empty()) {
+- label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format),
++ if (!tooltipFormat.empty()) {
++ label_.set_tooltip_text(fmt::format(fmt::runtime(tooltipFormat),
+ fmt::arg("node_name", node_name_),
+ fmt::arg("volume", vol), fmt::arg("icon", getIcon(vol))));
+ } else {
+@@ -317,31 +347,31 @@ bool waybar::modules::Wireplumber::handleScroll(GdkEventScroll* e) {
+ if (dir == SCROLL_DIR::NONE) {
+ return true;
+ }
+- double max_volume = 1;
++ double maxVolume = 1;
+ double step = 1.0 / 100.0;
+ if (config_["scroll-step"].isDouble()) {
+ step = config_["scroll-step"].asDouble() / 100.0;
+ }
+ if (config_["max-volume"].isDouble()) {
+- max_volume = config_["max-volume"].asDouble() / 100.0;
++ maxVolume = config_["max-volume"].asDouble() / 100.0;
+ }
+
+ if (step < min_step_) step = min_step_;
+
+- double new_vol = volume_;
++ double newVol = volume_;
+ if (dir == SCROLL_DIR::UP) {
+- if (volume_ < max_volume) {
+- new_vol = volume_ + step;
+- if (new_vol > max_volume) new_vol = max_volume;
++ if (volume_ < maxVolume) {
++ newVol = volume_ + step;
++ if (newVol > maxVolume) newVol = maxVolume;
+ }
+ } else if (dir == SCROLL_DIR::DOWN) {
+ if (volume_ > 0) {
+- new_vol = volume_ - step;
+- if (new_vol < 0) new_vol = 0;
++ newVol = volume_ - step;
++ if (newVol < 0) newVol = 0;
+ }
+ }
+- if (new_vol != volume_) {
+- GVariant* variant = g_variant_new_double(new_vol);
++ if (newVol != volume_) {
++ GVariant* variant = g_variant_new_double(newVol);
+ gboolean ret;
+ g_signal_emit_by_name(mixer_api_, "set-volume", node_id_, variant, &ret);
+ }
+
diff --git a/srcpkgs/Waybar/template b/srcpkgs/Waybar/template
index dae9e9bbce457b..14ca6e18282e76 100644
--- a/srcpkgs/Waybar/template
+++ b/srcpkgs/Waybar/template
@@ -1,7 +1,7 @@
# Template file for 'Waybar'
pkgname=Waybar
version=0.10.0
-revision=1
+revision=2
build_style=meson
configure_args="-Dlibudev=enabled -Dman-pages=enabled
-Dsystemd=disabled -Drfkill=enabled
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wireplumber: update to 0.5.0; revbump Waybar
2024-03-23 22:38 [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar cinerea0
@ 2024-04-03 3:39 ` Luciogi
2024-04-03 14:51 ` [PR PATCH] [Updated] " cinerea0
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luciogi @ 2024-04-03 3:39 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 171 bytes --]
New comment by Luciogi on void-packages repository
https://github.com/void-linux/void-packages/pull/49490#issuecomment-2033471263
Comment:
`wireplumber` 0.5.1 available
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Updated] wireplumber: update to 0.5.0; revbump Waybar
2024-03-23 22:38 [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar cinerea0
2024-04-03 3:39 ` Luciogi
@ 2024-04-03 14:51 ` cinerea0
2024-04-03 14:56 ` [PR PATCH] [Updated] wireplumber: update to 0.5.1; " cinerea0
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cinerea0 @ 2024-04-03 14:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
There is an updated pull request by cinerea0 against master on the void-packages repository
https://github.com/cinerea0/void-packages wireplumber
https://github.com/void-linux/void-packages/pull/49490
wireplumber: update to 0.5.0; revbump Waybar
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/49490.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-wireplumber-49490.patch --]
[-- Type: text/x-diff, Size: 24547 bytes --]
From 79ad15e5cb564d0455945b8bff7f9d508bf30292 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Wed, 3 Apr 2024 10:50:36 -0400
Subject: [PATCH 1/2] wireplumber: update to 0.5.1
---
common/shlibs | 2 +-
srcpkgs/wireplumber/INSTALL.msg | 4 ++++
srcpkgs/wireplumber/patches/test.patch | 16 ++++++++--------
srcpkgs/wireplumber/template | 4 ++--
4 files changed, 15 insertions(+), 11 deletions(-)
create mode 100644 srcpkgs/wireplumber/INSTALL.msg
diff --git a/common/shlibs b/common/shlibs
index 041ca865b19f4c..8ebd996815bcdf 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4260,7 +4260,7 @@ libayatana-ido3-0.4.so.0 ayatana-ido-0.9.2_1
libayatana-indicator3.so.7 libayatana-indicator-0.9.3_1
libayatana-appindicator3.so.1 libayatana-appindicator-0.5.91_1
libplayerctl.so.2 playerctl-2.4.1_1
-libwireplumber-0.4.so.0 wireplumber-0.4.14_1
+libwireplumber-0.5.so.0 wireplumber-0.5.0_1
libjodycode.so.3 libjodycode-3.0.1_1
libgsoapssl++-2.8.124.so gsoap-2.8.124_1
libjxl.so.0.10 libjxl-0.10.0_1
diff --git a/srcpkgs/wireplumber/INSTALL.msg b/srcpkgs/wireplumber/INSTALL.msg
new file mode 100644
index 00000000000000..eabe3de7348015
--- /dev/null
+++ b/srcpkgs/wireplumber/INSTALL.msg
@@ -0,0 +1,4 @@
+Wireplumber no longer supports lua configuration files as of version 0.5.
+If you have created or edited any lua configuration files for wireplumber,
+port them to SPA-JSON format using upstream's migration guide:
+https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/migration.html
diff --git a/srcpkgs/wireplumber/patches/test.patch b/srcpkgs/wireplumber/patches/test.patch
index 2340b3acad409e..590fa7ebc67b0b 100644
--- a/srcpkgs/wireplumber/patches/test.patch
+++ b/srcpkgs/wireplumber/patches/test.patch
@@ -7,17 +7,17 @@ https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/18
Also remove two other failing tests.
diff --git a/tests/modules/meson.build b/tests/modules/meson.build
-index 4b4d1bd..3385e4e 100644
+index f3f694e641f..994b4a45706 100644
--- a/tests/modules/meson.build
+++ b/tests/modules/meson.build
-@@ -24,13 +24,6 @@ test(
+@@ -26,13 +26,6 @@ test(
env: common_env,
)
-test(
- 'test-si-node',
- executable('test-si-node', 'si-node.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
@@ -25,31 +25,31 @@ index 4b4d1bd..3385e4e 100644
'test-si-audio-adapter',
executable('test-si-audio-adapter', 'si-audio-adapter.c',
diff --git a/tests/wp/meson.build b/tests/wp/meson.build
-index a18caf7..4df6ca6 100644
+index cc0b9ac85b0..360f39b2555 100644
--- a/tests/wp/meson.build
+++ b/tests/wp/meson.build
-@@ -34,13 +34,6 @@ test(
+@@ -38,13 +38,6 @@ test(
env: common_env,
)
-test(
- 'test-object-manager',
- executable('test-object-manager', 'object-manager.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
test(
'test-properties',
executable('test-properties', 'properties.c',
-@@ -48,13 +41,6 @@ test(
+@@ -52,13 +45,6 @@ test(
env: common_env,
)
-test(
- 'test-proxy',
- executable('test-proxy', 'proxy.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
diff --git a/srcpkgs/wireplumber/template b/srcpkgs/wireplumber/template
index 4ce4f959590ef2..b231c5d217c196 100644
--- a/srcpkgs/wireplumber/template
+++ b/srcpkgs/wireplumber/template
@@ -1,6 +1,6 @@
# Template file for 'wireplumber'
pkgname=wireplumber
-version=0.4.17
+version=0.5.1
revision=1
build_style=meson
build_helper=gir
@@ -14,7 +14,7 @@ license="MIT"
homepage="https://pipewire.pages.freedesktop.org/wireplumber"
changelog="https://gitlab.freedesktop.org/pipewire/wireplumber/-/raw/master/NEWS.rst"
distfiles="https://gitlab.freedesktop.org/pipewire/wireplumber/-/archive/$version/wireplumber-$version.tar.gz"
-checksum=a12534fd9c1ecf9fbc09f79192d9d57c9ab7bf01da82615ab4103b2f8e2e91a7
+checksum=9b776f5481a52f11b30ed46f8baf743534857b74ca3d3dc09a5b1602d5d5a466
provides="pipewire-session-manager-0_1"
post_install() {
From 5ebe4170d4a74f302134a268b1edb96981188743 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Wed, 3 Apr 2024 10:51:04 -0400
Subject: [PATCH 2/2] Waybar: rebuild for wireplumber-0.5
---
srcpkgs/Waybar/patches/wireplumber-0.5.patch | 419 +++++++++++++++++++
srcpkgs/Waybar/template | 2 +-
2 files changed, 420 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/Waybar/patches/wireplumber-0.5.patch
diff --git a/srcpkgs/Waybar/patches/wireplumber-0.5.patch b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
new file mode 100644
index 00000000000000..d6399a62c3aa9c
--- /dev/null
+++ b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
@@ -0,0 +1,419 @@
+From 2326727ccbf0456ccfd631e748955f7f67c44a4e Mon Sep 17 00:00:00 2001
+From: Ryan Walklin <ryan@testtoast.com>
+Date: Thu, 15 Feb 2024 09:37:36 +1300
+Subject: [PATCH] Update Wireplumber API to 0.5
+
+The WP component loader API has changed to be asynchronous, so implement a (GAsyncReadyCallback)-based loader to manage them. Logging integration change was required for 0.5.0 RCs but not for the 0.5.0 release.
+
+Fix clang-tidy and clang-format warnings. Note these are significantly wider than the changes for 0.5.0 so optional beyond the existing patchset.
+---
+ include/modules/wireplumber.hpp | 5 +-
+ meson.build | 2 +-
+ src/modules/wireplumber.cpp | 190 ++++++++++++++++++--------------
+ 3 files changed, 115 insertions(+), 82 deletions(-)
+
+diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
+index 9bbf4d464..6255b95fd 100644
+--- a/include/modules/wireplumber.hpp
++++ b/include/modules/wireplumber.hpp
+@@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
+ auto update() -> void override;
+
+ private:
+- void loadRequiredApiModules();
++ void asyncLoadRequiredApiModules();
+ void prepare();
+ void activatePlugins();
+ static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
+ static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
++ static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self);
++ static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
+ static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
+ static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
+diff --git a/meson.build b/meson.build
+index e21ff262c..120976083 100644
+--- a/meson.build
++++ b/meson.build
+@@ -92,7 +92,7 @@ libevdev = dependency('libevdev', required: get_option('libevdev'))
+ libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
+ xkbregistry = dependency('xkbregistry')
+ libjack = dependency('jack', required: get_option('jack'))
+-libwireplumber = dependency('wireplumber-0.4', required: get_option('wireplumber'))
++libwireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
+
+ libsndio = compiler.find_library('sndio', required: get_option('sndio'))
+ if libsndio.found()
+diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
+index 51bb708d1..bd019b623 100644
+--- a/src/modules/wireplumber.cpp
++++ b/src/modules/wireplumber.cpp
+@@ -18,31 +18,24 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
+ min_step_(0.0),
+ node_id_(0) {
+ wp_init(WP_INIT_PIPEWIRE);
+- wp_core_ = wp_core_new(NULL, NULL);
++ wp_core_ = wp_core_new(nullptr, nullptr, nullptr);
+ apis_ = g_ptr_array_new_with_free_func(g_object_unref);
+ om_ = wp_object_manager_new();
+
+ prepare();
+
+- loadRequiredApiModules();
++ spdlog::debug("[{}]: connecting to pipewire...", name_);
+
+- spdlog::debug("[{}]: connecting to pipewire...", this->name_);
+-
+- if (!wp_core_connect(wp_core_)) {
+- spdlog::error("[{}]: Could not connect to PipeWire", this->name_);
++ if (wp_core_connect(wp_core_) == 0) {
++ spdlog::error("[{}]: Could not connect to PipeWire", name_);
+ throw std::runtime_error("Could not connect to PipeWire\n");
+ }
+
+- spdlog::debug("[{}]: connected!", this->name_);
++ spdlog::debug("[{}]: connected!", name_);
+
+ g_signal_connect_swapped(om_, "installed", (GCallback)onObjectManagerInstalled, this);
+
+- activatePlugins();
+-
+- dp.emit();
+-
+- event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
+- event_box_.signal_scroll_event().connect(sigc::mem_fun(*this, &Wireplumber::handleScroll));
++ asyncLoadRequiredApiModules();
+ }
+
+ waybar::modules::Wireplumber::~Wireplumber() {
+@@ -63,32 +56,36 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
+ return;
+ }
+
+- auto proxy = static_cast<WpProxy*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_GLOBAL_PROXY, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ auto* proxy = static_cast<WpProxy*>(wp_object_manager_lookup(self->om_, WP_TYPE_GLOBAL_PROXY,
++ WP_CONSTRAINT_TYPE_G_PROPERTY,
++ "bound-id", "=u", id, nullptr));
+
+- if (!proxy) {
++ if (proxy == nullptr) {
+ auto err = fmt::format("Object '{}' not found\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+ }
+
+ g_autoptr(WpProperties) properties =
+- WP_IS_PIPEWIRE_OBJECT(proxy) ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
+- : wp_properties_new_empty();
+- g_autoptr(WpProperties) global_p = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
++ WP_IS_PIPEWIRE_OBJECT(proxy) != 0
++ ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
++ : wp_properties_new_empty();
++ g_autoptr(WpProperties) globalP = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
+ properties = wp_properties_ensure_unique_owner(properties);
+- wp_properties_add(properties, global_p);
+- wp_properties_set(properties, "object.id", NULL);
+- auto nick = wp_properties_get(properties, "node.nick");
+- auto description = wp_properties_get(properties, "node.description");
+-
+- self->node_name_ = nick ? nick : description ? description : "Unknown node name";
++ wp_properties_add(properties, globalP);
++ wp_properties_set(properties, "object.id", nullptr);
++ const auto* nick = wp_properties_get(properties, "node.nick");
++ const auto* description = wp_properties_get(properties, "node.description");
++
++ self->node_name_ = nick != nullptr ? nick
++ : description != nullptr ? description
++ : "Unknown node name";
+ spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_);
+ }
+
+ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* self, uint32_t id) {
+ spdlog::debug("[{}]: updating volume", self->name_);
+- GVariant* variant = NULL;
++ GVariant* variant = nullptr;
+
+ if (!isValidNodeId(id)) {
+ spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
+@@ -97,7 +94,7 @@ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* se
+
+ g_signal_emit_by_name(self->mixer_api_, "get-volume", id, &variant);
+
+- if (!variant) {
++ if (variant == nullptr) {
+ auto err = fmt::format("Node {} does not support volume\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+@@ -115,9 +112,9 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
+ return;
+ }
+@@ -140,49 +137,49 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
+ spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
+
+- uint32_t default_node_id;
+- g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id);
++ uint32_t defaultNodeId;
++ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &defaultNodeId);
+
+- if (!isValidNodeId(default_node_id)) {
++ if (!isValidNodeId(defaultNodeId)) {
+ spdlog::warn("[{}]: '{}' is not a valid node ID. Ignoring node change.", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(
+ wp_object_manager_lookup(self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id",
+- "=u", default_node_id, NULL));
++ "=u", defaultNodeId, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onDefaultNodesApiChanged) - Object with id {} not found", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+- const gchar* default_node_name =
++ const gchar* defaultNodeName =
+ wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name");
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - got the following default node: Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+- if (g_strcmp0(self->default_node_name_, default_node_name) == 0) {
++ if (g_strcmp0(self->default_node_name_, defaultNodeName) == 0) {
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node has not changed. Node(name: {}, id: {}). "
+ "Ignoring.",
+- self->name_, self->default_node_name_, default_node_id);
++ self->name_, self->default_node_name_, defaultNodeId);
+ return;
+ }
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node changed to -> Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+ g_free(self->default_node_name_);
+- self->default_node_name_ = g_strdup(default_node_name);
+- self->node_id_ = default_node_id;
+- updateVolume(self, default_node_id);
+- updateNodeName(self, default_node_id);
++ self->default_node_name_ = g_strdup(defaultNodeName);
++ self->node_id_ = defaultNodeId;
++ updateVolume(self, defaultNodeId);
++ updateNodeName(self, defaultNodeId);
+ }
+
+ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
+@@ -190,14 +187,14 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ self->def_nodes_api_ = wp_plugin_find(self->wp_core_, "default-nodes-api");
+
+- if (!self->def_nodes_api_) {
++ if (self->def_nodes_api_ == nullptr) {
+ spdlog::error("[{}]: default nodes api is not loaded.", self->name_);
+ throw std::runtime_error("Default nodes API is not loaded\n");
+ }
+
+ self->mixer_api_ = wp_plugin_find(self->wp_core_, "mixer-api");
+
+- if (!self->mixer_api_) {
++ if (self->mixer_api_ == nullptr) {
+ spdlog::error("[{}]: mixer api is not loaded.", self->name_);
+ throw std::runtime_error("Mixer api is not loaded\n");
+ }
+@@ -206,7 +203,7 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+ &self->default_node_name_);
+ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_);
+
+- if (self->default_node_name_) {
++ if (self->default_node_name_ != nullptr) {
+ spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
+ self->name_, self->default_node_name_, self->node_id_);
+ }
+@@ -221,11 +218,11 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
+ waybar::modules::Wireplumber* self) {
+- auto plugin_name = wp_plugin_get_name(WP_PLUGIN(p));
+- spdlog::debug("[{}]: onPluginActivated: {}", self->name_, plugin_name);
+- g_autoptr(GError) error = NULL;
++ const auto* pluginName = wp_plugin_get_name(WP_PLUGIN(p));
++ spdlog::debug("[{}]: onPluginActivated: {}", self->name_, pluginName);
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_object_activate_finish(p, res, &error)) {
++ if (wp_object_activate_finish(p, res, &error) == 0) {
+ spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
+ throw std::runtime_error(error->message);
+ }
+@@ -240,7 +237,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ for (uint16_t i = 0; i < apis_->len; i++) {
+ WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
+ pending_plugins_++;
+- wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, NULL,
++ wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, nullptr,
+ (GAsyncReadyCallback)onPluginActivated, this);
+ }
+ }
+@@ -248,34 +245,67 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ void waybar::modules::Wireplumber::prepare() {
+ spdlog::debug("[{}]: preparing object manager", name_);
+ wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
+- "=s", "Audio/Sink", NULL);
++ "=s", "Audio/Sink", nullptr);
+ }
+
+-void waybar::modules::Wireplumber::loadRequiredApiModules() {
+- spdlog::debug("[{}]: loading required modules", name_);
+- g_autoptr(GError) error = NULL;
++void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", NULL,
+- &error)) {
++ spdlog::debug("[{}]: callback loading default node api module", self->name_);
++
++ success = wp_core_load_component_finish(self->wp_core_, res, &error);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: default nodes API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
++ spdlog::debug("[{}]: loaded default nodes api", self->name_);
++ g_ptr_array_add(self->apis_, wp_plugin_find(self->wp_core_, "default-nodes-api"));
++
++ spdlog::debug("[{}]: loading mixer api module", self->name_);
++ wp_core_load_component(self->wp_core_, "libwireplumber-module-mixer-api", "module", nullptr,
++ "mixer-api", nullptr, (GAsyncReadyCallback)onMixerApiLoaded, self);
++}
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-mixer-api", "module", NULL,
+- &error)) {
++void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
++
++ success = wp_core_load_component_finish(self->wp_core_, res, nullptr);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: mixer API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
+
+- g_ptr_array_add(apis_, wp_plugin_find(wp_core_, "default-nodes-api"));
+- g_ptr_array_add(apis_, ({
+- WpPlugin* p = wp_plugin_find(wp_core_, "mixer-api");
+- g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, NULL);
++ spdlog::debug("[{}]: loaded mixer API", self->name_);
++ g_ptr_array_add(self->apis_, ({
++ WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
++ g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
+ p;
+ }));
++
++ self->activatePlugins();
++
++ self->dp.emit();
++
++ self->event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
++ self->event_box_.signal_scroll_event().connect(sigc::mem_fun(*self, &Wireplumber::handleScroll));
++}
++
++void waybar::modules::Wireplumber::asyncLoadRequiredApiModules() {
++ spdlog::debug("[{}]: loading default nodes api module", name_);
++ wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", nullptr,
++ "default-nodes-api", nullptr, (GAsyncReadyCallback)onDefaultNodesApiLoaded,
++ this);
+ }
+
+ auto waybar::modules::Wireplumber::update() -> void {
+ auto format = format_;
+- std::string tooltip_format;
++ std::string tooltipFormat;
+
+ if (muted_) {
+ format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
+@@ -292,12 +322,12 @@ auto waybar::modules::Wireplumber::update() -> void {
+ getState(vol);
+
+ if (tooltipEnabled()) {
+- if (tooltip_format.empty() && config_["tooltip-format"].isString()) {
+- tooltip_format = config_["tooltip-format"].asString();
++ if (tooltipFormat.empty() && config_["tooltip-format"].isString()) {
++ tooltipFormat = config_["tooltip-format"].asString();
+ }
+
+- if (!tooltip_format.empty()) {
+- label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format),
++ if (!tooltipFormat.empty()) {
++ label_.set_tooltip_text(fmt::format(fmt::runtime(tooltipFormat),
+ fmt::arg("node_name", node_name_),
+ fmt::arg("volume", vol), fmt::arg("icon", getIcon(vol))));
+ } else {
+@@ -317,31 +347,31 @@ bool waybar::modules::Wireplumber::handleScroll(GdkEventScroll* e) {
+ if (dir == SCROLL_DIR::NONE) {
+ return true;
+ }
+- double max_volume = 1;
++ double maxVolume = 1;
+ double step = 1.0 / 100.0;
+ if (config_["scroll-step"].isDouble()) {
+ step = config_["scroll-step"].asDouble() / 100.0;
+ }
+ if (config_["max-volume"].isDouble()) {
+- max_volume = config_["max-volume"].asDouble() / 100.0;
++ maxVolume = config_["max-volume"].asDouble() / 100.0;
+ }
+
+ if (step < min_step_) step = min_step_;
+
+- double new_vol = volume_;
++ double newVol = volume_;
+ if (dir == SCROLL_DIR::UP) {
+- if (volume_ < max_volume) {
+- new_vol = volume_ + step;
+- if (new_vol > max_volume) new_vol = max_volume;
++ if (volume_ < maxVolume) {
++ newVol = volume_ + step;
++ if (newVol > maxVolume) newVol = maxVolume;
+ }
+ } else if (dir == SCROLL_DIR::DOWN) {
+ if (volume_ > 0) {
+- new_vol = volume_ - step;
+- if (new_vol < 0) new_vol = 0;
++ newVol = volume_ - step;
++ if (newVol < 0) newVol = 0;
+ }
+ }
+- if (new_vol != volume_) {
+- GVariant* variant = g_variant_new_double(new_vol);
++ if (newVol != volume_) {
++ GVariant* variant = g_variant_new_double(newVol);
+ gboolean ret;
+ g_signal_emit_by_name(mixer_api_, "set-volume", node_id_, variant, &ret);
+ }
+
diff --git a/srcpkgs/Waybar/template b/srcpkgs/Waybar/template
index dae9e9bbce457b..14ca6e18282e76 100644
--- a/srcpkgs/Waybar/template
+++ b/srcpkgs/Waybar/template
@@ -1,7 +1,7 @@
# Template file for 'Waybar'
pkgname=Waybar
version=0.10.0
-revision=1
+revision=2
build_style=meson
configure_args="-Dlibudev=enabled -Dman-pages=enabled
-Dsystemd=disabled -Drfkill=enabled
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Updated] wireplumber: update to 0.5.1; revbump Waybar
2024-03-23 22:38 [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar cinerea0
2024-04-03 3:39 ` Luciogi
2024-04-03 14:51 ` [PR PATCH] [Updated] " cinerea0
@ 2024-04-03 14:56 ` cinerea0
2024-04-22 15:38 ` cinerea0
2024-04-22 16:16 ` [PR PATCH] [Merged]: wireplumber: update to 0.5.2; " cinerea0
4 siblings, 0 replies; 6+ messages in thread
From: cinerea0 @ 2024-04-03 14:56 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
There is an updated pull request by cinerea0 against master on the void-packages repository
https://github.com/cinerea0/void-packages wireplumber
https://github.com/void-linux/void-packages/pull/49490
wireplumber: update to 0.5.1; revbump Waybar
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/49490.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-wireplumber-49490.patch --]
[-- Type: text/x-diff, Size: 24547 bytes --]
From 7ff301e61a86c588a9b1712dbeb78e098357ff47 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Wed, 3 Apr 2024 10:55:34 -0400
Subject: [PATCH 1/2] wireplumber: update to 0.5.1
---
common/shlibs | 2 +-
srcpkgs/wireplumber/INSTALL.msg | 4 ++++
srcpkgs/wireplumber/patches/test.patch | 16 ++++++++--------
srcpkgs/wireplumber/template | 4 ++--
4 files changed, 15 insertions(+), 11 deletions(-)
create mode 100644 srcpkgs/wireplumber/INSTALL.msg
diff --git a/common/shlibs b/common/shlibs
index 041ca865b19f4c..f992f9d5016c8e 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4260,7 +4260,7 @@ libayatana-ido3-0.4.so.0 ayatana-ido-0.9.2_1
libayatana-indicator3.so.7 libayatana-indicator-0.9.3_1
libayatana-appindicator3.so.1 libayatana-appindicator-0.5.91_1
libplayerctl.so.2 playerctl-2.4.1_1
-libwireplumber-0.4.so.0 wireplumber-0.4.14_1
+libwireplumber-0.5.so.0 wireplumber-0.5.1_1
libjodycode.so.3 libjodycode-3.0.1_1
libgsoapssl++-2.8.124.so gsoap-2.8.124_1
libjxl.so.0.10 libjxl-0.10.0_1
diff --git a/srcpkgs/wireplumber/INSTALL.msg b/srcpkgs/wireplumber/INSTALL.msg
new file mode 100644
index 00000000000000..eabe3de7348015
--- /dev/null
+++ b/srcpkgs/wireplumber/INSTALL.msg
@@ -0,0 +1,4 @@
+Wireplumber no longer supports lua configuration files as of version 0.5.
+If you have created or edited any lua configuration files for wireplumber,
+port them to SPA-JSON format using upstream's migration guide:
+https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/migration.html
diff --git a/srcpkgs/wireplumber/patches/test.patch b/srcpkgs/wireplumber/patches/test.patch
index 2340b3acad409e..590fa7ebc67b0b 100644
--- a/srcpkgs/wireplumber/patches/test.patch
+++ b/srcpkgs/wireplumber/patches/test.patch
@@ -7,17 +7,17 @@ https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/18
Also remove two other failing tests.
diff --git a/tests/modules/meson.build b/tests/modules/meson.build
-index 4b4d1bd..3385e4e 100644
+index f3f694e641f..994b4a45706 100644
--- a/tests/modules/meson.build
+++ b/tests/modules/meson.build
-@@ -24,13 +24,6 @@ test(
+@@ -26,13 +26,6 @@ test(
env: common_env,
)
-test(
- 'test-si-node',
- executable('test-si-node', 'si-node.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
@@ -25,31 +25,31 @@ index 4b4d1bd..3385e4e 100644
'test-si-audio-adapter',
executable('test-si-audio-adapter', 'si-audio-adapter.c',
diff --git a/tests/wp/meson.build b/tests/wp/meson.build
-index a18caf7..4df6ca6 100644
+index cc0b9ac85b0..360f39b2555 100644
--- a/tests/wp/meson.build
+++ b/tests/wp/meson.build
-@@ -34,13 +34,6 @@ test(
+@@ -38,13 +38,6 @@ test(
env: common_env,
)
-test(
- 'test-object-manager',
- executable('test-object-manager', 'object-manager.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
test(
'test-properties',
executable('test-properties', 'properties.c',
-@@ -48,13 +41,6 @@ test(
+@@ -52,13 +45,6 @@ test(
env: common_env,
)
-test(
- 'test-proxy',
- executable('test-proxy', 'proxy.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
diff --git a/srcpkgs/wireplumber/template b/srcpkgs/wireplumber/template
index 4ce4f959590ef2..b231c5d217c196 100644
--- a/srcpkgs/wireplumber/template
+++ b/srcpkgs/wireplumber/template
@@ -1,6 +1,6 @@
# Template file for 'wireplumber'
pkgname=wireplumber
-version=0.4.17
+version=0.5.1
revision=1
build_style=meson
build_helper=gir
@@ -14,7 +14,7 @@ license="MIT"
homepage="https://pipewire.pages.freedesktop.org/wireplumber"
changelog="https://gitlab.freedesktop.org/pipewire/wireplumber/-/raw/master/NEWS.rst"
distfiles="https://gitlab.freedesktop.org/pipewire/wireplumber/-/archive/$version/wireplumber-$version.tar.gz"
-checksum=a12534fd9c1ecf9fbc09f79192d9d57c9ab7bf01da82615ab4103b2f8e2e91a7
+checksum=9b776f5481a52f11b30ed46f8baf743534857b74ca3d3dc09a5b1602d5d5a466
provides="pipewire-session-manager-0_1"
post_install() {
From 7f01abe515d55de79bbf22896a4c57b927f19566 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Wed, 3 Apr 2024 10:55:54 -0400
Subject: [PATCH 2/2] Waybar: rebuild for wireplumber-0.5
---
srcpkgs/Waybar/patches/wireplumber-0.5.patch | 419 +++++++++++++++++++
srcpkgs/Waybar/template | 2 +-
2 files changed, 420 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/Waybar/patches/wireplumber-0.5.patch
diff --git a/srcpkgs/Waybar/patches/wireplumber-0.5.patch b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
new file mode 100644
index 00000000000000..d6399a62c3aa9c
--- /dev/null
+++ b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
@@ -0,0 +1,419 @@
+From 2326727ccbf0456ccfd631e748955f7f67c44a4e Mon Sep 17 00:00:00 2001
+From: Ryan Walklin <ryan@testtoast.com>
+Date: Thu, 15 Feb 2024 09:37:36 +1300
+Subject: [PATCH] Update Wireplumber API to 0.5
+
+The WP component loader API has changed to be asynchronous, so implement a (GAsyncReadyCallback)-based loader to manage them. Logging integration change was required for 0.5.0 RCs but not for the 0.5.0 release.
+
+Fix clang-tidy and clang-format warnings. Note these are significantly wider than the changes for 0.5.0 so optional beyond the existing patchset.
+---
+ include/modules/wireplumber.hpp | 5 +-
+ meson.build | 2 +-
+ src/modules/wireplumber.cpp | 190 ++++++++++++++++++--------------
+ 3 files changed, 115 insertions(+), 82 deletions(-)
+
+diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
+index 9bbf4d464..6255b95fd 100644
+--- a/include/modules/wireplumber.hpp
++++ b/include/modules/wireplumber.hpp
+@@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
+ auto update() -> void override;
+
+ private:
+- void loadRequiredApiModules();
++ void asyncLoadRequiredApiModules();
+ void prepare();
+ void activatePlugins();
+ static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
+ static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
++ static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self);
++ static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
+ static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
+ static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
+diff --git a/meson.build b/meson.build
+index e21ff262c..120976083 100644
+--- a/meson.build
++++ b/meson.build
+@@ -92,7 +92,7 @@ libevdev = dependency('libevdev', required: get_option('libevdev'))
+ libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
+ xkbregistry = dependency('xkbregistry')
+ libjack = dependency('jack', required: get_option('jack'))
+-libwireplumber = dependency('wireplumber-0.4', required: get_option('wireplumber'))
++libwireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
+
+ libsndio = compiler.find_library('sndio', required: get_option('sndio'))
+ if libsndio.found()
+diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
+index 51bb708d1..bd019b623 100644
+--- a/src/modules/wireplumber.cpp
++++ b/src/modules/wireplumber.cpp
+@@ -18,31 +18,24 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
+ min_step_(0.0),
+ node_id_(0) {
+ wp_init(WP_INIT_PIPEWIRE);
+- wp_core_ = wp_core_new(NULL, NULL);
++ wp_core_ = wp_core_new(nullptr, nullptr, nullptr);
+ apis_ = g_ptr_array_new_with_free_func(g_object_unref);
+ om_ = wp_object_manager_new();
+
+ prepare();
+
+- loadRequiredApiModules();
++ spdlog::debug("[{}]: connecting to pipewire...", name_);
+
+- spdlog::debug("[{}]: connecting to pipewire...", this->name_);
+-
+- if (!wp_core_connect(wp_core_)) {
+- spdlog::error("[{}]: Could not connect to PipeWire", this->name_);
++ if (wp_core_connect(wp_core_) == 0) {
++ spdlog::error("[{}]: Could not connect to PipeWire", name_);
+ throw std::runtime_error("Could not connect to PipeWire\n");
+ }
+
+- spdlog::debug("[{}]: connected!", this->name_);
++ spdlog::debug("[{}]: connected!", name_);
+
+ g_signal_connect_swapped(om_, "installed", (GCallback)onObjectManagerInstalled, this);
+
+- activatePlugins();
+-
+- dp.emit();
+-
+- event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
+- event_box_.signal_scroll_event().connect(sigc::mem_fun(*this, &Wireplumber::handleScroll));
++ asyncLoadRequiredApiModules();
+ }
+
+ waybar::modules::Wireplumber::~Wireplumber() {
+@@ -63,32 +56,36 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
+ return;
+ }
+
+- auto proxy = static_cast<WpProxy*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_GLOBAL_PROXY, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ auto* proxy = static_cast<WpProxy*>(wp_object_manager_lookup(self->om_, WP_TYPE_GLOBAL_PROXY,
++ WP_CONSTRAINT_TYPE_G_PROPERTY,
++ "bound-id", "=u", id, nullptr));
+
+- if (!proxy) {
++ if (proxy == nullptr) {
+ auto err = fmt::format("Object '{}' not found\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+ }
+
+ g_autoptr(WpProperties) properties =
+- WP_IS_PIPEWIRE_OBJECT(proxy) ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
+- : wp_properties_new_empty();
+- g_autoptr(WpProperties) global_p = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
++ WP_IS_PIPEWIRE_OBJECT(proxy) != 0
++ ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
++ : wp_properties_new_empty();
++ g_autoptr(WpProperties) globalP = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
+ properties = wp_properties_ensure_unique_owner(properties);
+- wp_properties_add(properties, global_p);
+- wp_properties_set(properties, "object.id", NULL);
+- auto nick = wp_properties_get(properties, "node.nick");
+- auto description = wp_properties_get(properties, "node.description");
+-
+- self->node_name_ = nick ? nick : description ? description : "Unknown node name";
++ wp_properties_add(properties, globalP);
++ wp_properties_set(properties, "object.id", nullptr);
++ const auto* nick = wp_properties_get(properties, "node.nick");
++ const auto* description = wp_properties_get(properties, "node.description");
++
++ self->node_name_ = nick != nullptr ? nick
++ : description != nullptr ? description
++ : "Unknown node name";
+ spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_);
+ }
+
+ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* self, uint32_t id) {
+ spdlog::debug("[{}]: updating volume", self->name_);
+- GVariant* variant = NULL;
++ GVariant* variant = nullptr;
+
+ if (!isValidNodeId(id)) {
+ spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
+@@ -97,7 +94,7 @@ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* se
+
+ g_signal_emit_by_name(self->mixer_api_, "get-volume", id, &variant);
+
+- if (!variant) {
++ if (variant == nullptr) {
+ auto err = fmt::format("Node {} does not support volume\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+@@ -115,9 +112,9 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
+ return;
+ }
+@@ -140,49 +137,49 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
+ spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
+
+- uint32_t default_node_id;
+- g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id);
++ uint32_t defaultNodeId;
++ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &defaultNodeId);
+
+- if (!isValidNodeId(default_node_id)) {
++ if (!isValidNodeId(defaultNodeId)) {
+ spdlog::warn("[{}]: '{}' is not a valid node ID. Ignoring node change.", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(
+ wp_object_manager_lookup(self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id",
+- "=u", default_node_id, NULL));
++ "=u", defaultNodeId, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onDefaultNodesApiChanged) - Object with id {} not found", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+- const gchar* default_node_name =
++ const gchar* defaultNodeName =
+ wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name");
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - got the following default node: Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+- if (g_strcmp0(self->default_node_name_, default_node_name) == 0) {
++ if (g_strcmp0(self->default_node_name_, defaultNodeName) == 0) {
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node has not changed. Node(name: {}, id: {}). "
+ "Ignoring.",
+- self->name_, self->default_node_name_, default_node_id);
++ self->name_, self->default_node_name_, defaultNodeId);
+ return;
+ }
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node changed to -> Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+ g_free(self->default_node_name_);
+- self->default_node_name_ = g_strdup(default_node_name);
+- self->node_id_ = default_node_id;
+- updateVolume(self, default_node_id);
+- updateNodeName(self, default_node_id);
++ self->default_node_name_ = g_strdup(defaultNodeName);
++ self->node_id_ = defaultNodeId;
++ updateVolume(self, defaultNodeId);
++ updateNodeName(self, defaultNodeId);
+ }
+
+ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
+@@ -190,14 +187,14 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ self->def_nodes_api_ = wp_plugin_find(self->wp_core_, "default-nodes-api");
+
+- if (!self->def_nodes_api_) {
++ if (self->def_nodes_api_ == nullptr) {
+ spdlog::error("[{}]: default nodes api is not loaded.", self->name_);
+ throw std::runtime_error("Default nodes API is not loaded\n");
+ }
+
+ self->mixer_api_ = wp_plugin_find(self->wp_core_, "mixer-api");
+
+- if (!self->mixer_api_) {
++ if (self->mixer_api_ == nullptr) {
+ spdlog::error("[{}]: mixer api is not loaded.", self->name_);
+ throw std::runtime_error("Mixer api is not loaded\n");
+ }
+@@ -206,7 +203,7 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+ &self->default_node_name_);
+ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_);
+
+- if (self->default_node_name_) {
++ if (self->default_node_name_ != nullptr) {
+ spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
+ self->name_, self->default_node_name_, self->node_id_);
+ }
+@@ -221,11 +218,11 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
+ waybar::modules::Wireplumber* self) {
+- auto plugin_name = wp_plugin_get_name(WP_PLUGIN(p));
+- spdlog::debug("[{}]: onPluginActivated: {}", self->name_, plugin_name);
+- g_autoptr(GError) error = NULL;
++ const auto* pluginName = wp_plugin_get_name(WP_PLUGIN(p));
++ spdlog::debug("[{}]: onPluginActivated: {}", self->name_, pluginName);
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_object_activate_finish(p, res, &error)) {
++ if (wp_object_activate_finish(p, res, &error) == 0) {
+ spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
+ throw std::runtime_error(error->message);
+ }
+@@ -240,7 +237,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ for (uint16_t i = 0; i < apis_->len; i++) {
+ WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
+ pending_plugins_++;
+- wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, NULL,
++ wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, nullptr,
+ (GAsyncReadyCallback)onPluginActivated, this);
+ }
+ }
+@@ -248,34 +245,67 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ void waybar::modules::Wireplumber::prepare() {
+ spdlog::debug("[{}]: preparing object manager", name_);
+ wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
+- "=s", "Audio/Sink", NULL);
++ "=s", "Audio/Sink", nullptr);
+ }
+
+-void waybar::modules::Wireplumber::loadRequiredApiModules() {
+- spdlog::debug("[{}]: loading required modules", name_);
+- g_autoptr(GError) error = NULL;
++void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", NULL,
+- &error)) {
++ spdlog::debug("[{}]: callback loading default node api module", self->name_);
++
++ success = wp_core_load_component_finish(self->wp_core_, res, &error);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: default nodes API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
++ spdlog::debug("[{}]: loaded default nodes api", self->name_);
++ g_ptr_array_add(self->apis_, wp_plugin_find(self->wp_core_, "default-nodes-api"));
++
++ spdlog::debug("[{}]: loading mixer api module", self->name_);
++ wp_core_load_component(self->wp_core_, "libwireplumber-module-mixer-api", "module", nullptr,
++ "mixer-api", nullptr, (GAsyncReadyCallback)onMixerApiLoaded, self);
++}
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-mixer-api", "module", NULL,
+- &error)) {
++void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
++
++ success = wp_core_load_component_finish(self->wp_core_, res, nullptr);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: mixer API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
+
+- g_ptr_array_add(apis_, wp_plugin_find(wp_core_, "default-nodes-api"));
+- g_ptr_array_add(apis_, ({
+- WpPlugin* p = wp_plugin_find(wp_core_, "mixer-api");
+- g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, NULL);
++ spdlog::debug("[{}]: loaded mixer API", self->name_);
++ g_ptr_array_add(self->apis_, ({
++ WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
++ g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
+ p;
+ }));
++
++ self->activatePlugins();
++
++ self->dp.emit();
++
++ self->event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
++ self->event_box_.signal_scroll_event().connect(sigc::mem_fun(*self, &Wireplumber::handleScroll));
++}
++
++void waybar::modules::Wireplumber::asyncLoadRequiredApiModules() {
++ spdlog::debug("[{}]: loading default nodes api module", name_);
++ wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", nullptr,
++ "default-nodes-api", nullptr, (GAsyncReadyCallback)onDefaultNodesApiLoaded,
++ this);
+ }
+
+ auto waybar::modules::Wireplumber::update() -> void {
+ auto format = format_;
+- std::string tooltip_format;
++ std::string tooltipFormat;
+
+ if (muted_) {
+ format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
+@@ -292,12 +322,12 @@ auto waybar::modules::Wireplumber::update() -> void {
+ getState(vol);
+
+ if (tooltipEnabled()) {
+- if (tooltip_format.empty() && config_["tooltip-format"].isString()) {
+- tooltip_format = config_["tooltip-format"].asString();
++ if (tooltipFormat.empty() && config_["tooltip-format"].isString()) {
++ tooltipFormat = config_["tooltip-format"].asString();
+ }
+
+- if (!tooltip_format.empty()) {
+- label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format),
++ if (!tooltipFormat.empty()) {
++ label_.set_tooltip_text(fmt::format(fmt::runtime(tooltipFormat),
+ fmt::arg("node_name", node_name_),
+ fmt::arg("volume", vol), fmt::arg("icon", getIcon(vol))));
+ } else {
+@@ -317,31 +347,31 @@ bool waybar::modules::Wireplumber::handleScroll(GdkEventScroll* e) {
+ if (dir == SCROLL_DIR::NONE) {
+ return true;
+ }
+- double max_volume = 1;
++ double maxVolume = 1;
+ double step = 1.0 / 100.0;
+ if (config_["scroll-step"].isDouble()) {
+ step = config_["scroll-step"].asDouble() / 100.0;
+ }
+ if (config_["max-volume"].isDouble()) {
+- max_volume = config_["max-volume"].asDouble() / 100.0;
++ maxVolume = config_["max-volume"].asDouble() / 100.0;
+ }
+
+ if (step < min_step_) step = min_step_;
+
+- double new_vol = volume_;
++ double newVol = volume_;
+ if (dir == SCROLL_DIR::UP) {
+- if (volume_ < max_volume) {
+- new_vol = volume_ + step;
+- if (new_vol > max_volume) new_vol = max_volume;
++ if (volume_ < maxVolume) {
++ newVol = volume_ + step;
++ if (newVol > maxVolume) newVol = maxVolume;
+ }
+ } else if (dir == SCROLL_DIR::DOWN) {
+ if (volume_ > 0) {
+- new_vol = volume_ - step;
+- if (new_vol < 0) new_vol = 0;
++ newVol = volume_ - step;
++ if (newVol < 0) newVol = 0;
+ }
+ }
+- if (new_vol != volume_) {
+- GVariant* variant = g_variant_new_double(new_vol);
++ if (newVol != volume_) {
++ GVariant* variant = g_variant_new_double(newVol);
+ gboolean ret;
+ g_signal_emit_by_name(mixer_api_, "set-volume", node_id_, variant, &ret);
+ }
+
diff --git a/srcpkgs/Waybar/template b/srcpkgs/Waybar/template
index dae9e9bbce457b..14ca6e18282e76 100644
--- a/srcpkgs/Waybar/template
+++ b/srcpkgs/Waybar/template
@@ -1,7 +1,7 @@
# Template file for 'Waybar'
pkgname=Waybar
version=0.10.0
-revision=1
+revision=2
build_style=meson
configure_args="-Dlibudev=enabled -Dman-pages=enabled
-Dsystemd=disabled -Drfkill=enabled
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Updated] wireplumber: update to 0.5.1; revbump Waybar
2024-03-23 22:38 [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar cinerea0
` (2 preceding siblings ...)
2024-04-03 14:56 ` [PR PATCH] [Updated] wireplumber: update to 0.5.1; " cinerea0
@ 2024-04-22 15:38 ` cinerea0
2024-04-22 16:16 ` [PR PATCH] [Merged]: wireplumber: update to 0.5.2; " cinerea0
4 siblings, 0 replies; 6+ messages in thread
From: cinerea0 @ 2024-04-22 15:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
There is an updated pull request by cinerea0 against master on the void-packages repository
https://github.com/cinerea0/void-packages wireplumber
https://github.com/void-linux/void-packages/pull/49490
wireplumber: update to 0.5.1; revbump Waybar
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/49490.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-wireplumber-49490.patch --]
[-- Type: text/x-diff, Size: 24549 bytes --]
From 506363d9ba4d6ef7b1c348853fed2d58e56d2c68 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Mon, 22 Apr 2024 11:37:52 -0400
Subject: [PATCH 1/2] wireplumber: update to 0.5.2
---
common/shlibs | 2 +-
srcpkgs/wireplumber/INSTALL.msg | 4 ++++
srcpkgs/wireplumber/patches/test.patch | 16 ++++++++--------
srcpkgs/wireplumber/template | 4 ++--
4 files changed, 15 insertions(+), 11 deletions(-)
create mode 100644 srcpkgs/wireplumber/INSTALL.msg
diff --git a/common/shlibs b/common/shlibs
index 9df69605150b67..4fe3b26a2e0378 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4259,7 +4259,7 @@ libayatana-ido3-0.4.so.0 ayatana-ido-0.9.2_1
libayatana-indicator3.so.7 libayatana-indicator-0.9.3_1
libayatana-appindicator3.so.1 libayatana-appindicator-0.5.91_1
libplayerctl.so.2 playerctl-2.4.1_1
-libwireplumber-0.4.so.0 wireplumber-0.4.14_1
+libwireplumber-0.5.so.0 wireplumber-0.5.2_1
libjodycode.so.3 libjodycode-3.0.1_1
libgsoapssl++-2.8.124.so gsoap-2.8.124_1
libjxl.so.0.10 libjxl-0.10.0_1
diff --git a/srcpkgs/wireplumber/INSTALL.msg b/srcpkgs/wireplumber/INSTALL.msg
new file mode 100644
index 00000000000000..eabe3de7348015
--- /dev/null
+++ b/srcpkgs/wireplumber/INSTALL.msg
@@ -0,0 +1,4 @@
+Wireplumber no longer supports lua configuration files as of version 0.5.
+If you have created or edited any lua configuration files for wireplumber,
+port them to SPA-JSON format using upstream's migration guide:
+https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/migration.html
diff --git a/srcpkgs/wireplumber/patches/test.patch b/srcpkgs/wireplumber/patches/test.patch
index 2340b3acad409e..590fa7ebc67b0b 100644
--- a/srcpkgs/wireplumber/patches/test.patch
+++ b/srcpkgs/wireplumber/patches/test.patch
@@ -7,17 +7,17 @@ https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/18
Also remove two other failing tests.
diff --git a/tests/modules/meson.build b/tests/modules/meson.build
-index 4b4d1bd..3385e4e 100644
+index f3f694e641f..994b4a45706 100644
--- a/tests/modules/meson.build
+++ b/tests/modules/meson.build
-@@ -24,13 +24,6 @@ test(
+@@ -26,13 +26,6 @@ test(
env: common_env,
)
-test(
- 'test-si-node',
- executable('test-si-node', 'si-node.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
@@ -25,31 +25,31 @@ index 4b4d1bd..3385e4e 100644
'test-si-audio-adapter',
executable('test-si-audio-adapter', 'si-audio-adapter.c',
diff --git a/tests/wp/meson.build b/tests/wp/meson.build
-index a18caf7..4df6ca6 100644
+index cc0b9ac85b0..360f39b2555 100644
--- a/tests/wp/meson.build
+++ b/tests/wp/meson.build
-@@ -34,13 +34,6 @@ test(
+@@ -38,13 +38,6 @@ test(
env: common_env,
)
-test(
- 'test-object-manager',
- executable('test-object-manager', 'object-manager.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
test(
'test-properties',
executable('test-properties', 'properties.c',
-@@ -48,13 +41,6 @@ test(
+@@ -52,13 +45,6 @@ test(
env: common_env,
)
-test(
- 'test-proxy',
- executable('test-proxy', 'proxy.c',
-- dependencies: common_deps, c_args: common_args),
+- dependencies: common_deps),
- env: common_env,
-)
-
diff --git a/srcpkgs/wireplumber/template b/srcpkgs/wireplumber/template
index 4ce4f959590ef2..2836843b914c83 100644
--- a/srcpkgs/wireplumber/template
+++ b/srcpkgs/wireplumber/template
@@ -1,6 +1,6 @@
# Template file for 'wireplumber'
pkgname=wireplumber
-version=0.4.17
+version=0.5.2
revision=1
build_style=meson
build_helper=gir
@@ -14,7 +14,7 @@ license="MIT"
homepage="https://pipewire.pages.freedesktop.org/wireplumber"
changelog="https://gitlab.freedesktop.org/pipewire/wireplumber/-/raw/master/NEWS.rst"
distfiles="https://gitlab.freedesktop.org/pipewire/wireplumber/-/archive/$version/wireplumber-$version.tar.gz"
-checksum=a12534fd9c1ecf9fbc09f79192d9d57c9ab7bf01da82615ab4103b2f8e2e91a7
+checksum=24ecc2323f7c39fe577b50903c324cfcbb77b9ea2da01baffd3467c9dbad1d8a
provides="pipewire-session-manager-0_1"
post_install() {
From 9bcbde628669bd15df6d41b15c8b2a3245faddb9 Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Mon, 22 Apr 2024 11:38:35 -0400
Subject: [PATCH 2/2] Waybar: rebuild for wireplumber-0.5
---
srcpkgs/Waybar/patches/wireplumber-0.5.patch | 419 +++++++++++++++++++
srcpkgs/Waybar/template | 2 +-
2 files changed, 420 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/Waybar/patches/wireplumber-0.5.patch
diff --git a/srcpkgs/Waybar/patches/wireplumber-0.5.patch b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
new file mode 100644
index 00000000000000..d6399a62c3aa9c
--- /dev/null
+++ b/srcpkgs/Waybar/patches/wireplumber-0.5.patch
@@ -0,0 +1,419 @@
+From 2326727ccbf0456ccfd631e748955f7f67c44a4e Mon Sep 17 00:00:00 2001
+From: Ryan Walklin <ryan@testtoast.com>
+Date: Thu, 15 Feb 2024 09:37:36 +1300
+Subject: [PATCH] Update Wireplumber API to 0.5
+
+The WP component loader API has changed to be asynchronous, so implement a (GAsyncReadyCallback)-based loader to manage them. Logging integration change was required for 0.5.0 RCs but not for the 0.5.0 release.
+
+Fix clang-tidy and clang-format warnings. Note these are significantly wider than the changes for 0.5.0 so optional beyond the existing patchset.
+---
+ include/modules/wireplumber.hpp | 5 +-
+ meson.build | 2 +-
+ src/modules/wireplumber.cpp | 190 ++++++++++++++++++--------------
+ 3 files changed, 115 insertions(+), 82 deletions(-)
+
+diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
+index 9bbf4d464..6255b95fd 100644
+--- a/include/modules/wireplumber.hpp
++++ b/include/modules/wireplumber.hpp
+@@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
+ auto update() -> void override;
+
+ private:
+- void loadRequiredApiModules();
++ void asyncLoadRequiredApiModules();
+ void prepare();
+ void activatePlugins();
+ static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
+ static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
++ static void onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self);
++ static void onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
+ static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
+ static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
+ static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
+diff --git a/meson.build b/meson.build
+index e21ff262c..120976083 100644
+--- a/meson.build
++++ b/meson.build
+@@ -92,7 +92,7 @@ libevdev = dependency('libevdev', required: get_option('libevdev'))
+ libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
+ xkbregistry = dependency('xkbregistry')
+ libjack = dependency('jack', required: get_option('jack'))
+-libwireplumber = dependency('wireplumber-0.4', required: get_option('wireplumber'))
++libwireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
+
+ libsndio = compiler.find_library('sndio', required: get_option('sndio'))
+ if libsndio.found()
+diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
+index 51bb708d1..bd019b623 100644
+--- a/src/modules/wireplumber.cpp
++++ b/src/modules/wireplumber.cpp
+@@ -18,31 +18,24 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
+ min_step_(0.0),
+ node_id_(0) {
+ wp_init(WP_INIT_PIPEWIRE);
+- wp_core_ = wp_core_new(NULL, NULL);
++ wp_core_ = wp_core_new(nullptr, nullptr, nullptr);
+ apis_ = g_ptr_array_new_with_free_func(g_object_unref);
+ om_ = wp_object_manager_new();
+
+ prepare();
+
+- loadRequiredApiModules();
++ spdlog::debug("[{}]: connecting to pipewire...", name_);
+
+- spdlog::debug("[{}]: connecting to pipewire...", this->name_);
+-
+- if (!wp_core_connect(wp_core_)) {
+- spdlog::error("[{}]: Could not connect to PipeWire", this->name_);
++ if (wp_core_connect(wp_core_) == 0) {
++ spdlog::error("[{}]: Could not connect to PipeWire", name_);
+ throw std::runtime_error("Could not connect to PipeWire\n");
+ }
+
+- spdlog::debug("[{}]: connected!", this->name_);
++ spdlog::debug("[{}]: connected!", name_);
+
+ g_signal_connect_swapped(om_, "installed", (GCallback)onObjectManagerInstalled, this);
+
+- activatePlugins();
+-
+- dp.emit();
+-
+- event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
+- event_box_.signal_scroll_event().connect(sigc::mem_fun(*this, &Wireplumber::handleScroll));
++ asyncLoadRequiredApiModules();
+ }
+
+ waybar::modules::Wireplumber::~Wireplumber() {
+@@ -63,32 +56,36 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
+ return;
+ }
+
+- auto proxy = static_cast<WpProxy*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_GLOBAL_PROXY, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ auto* proxy = static_cast<WpProxy*>(wp_object_manager_lookup(self->om_, WP_TYPE_GLOBAL_PROXY,
++ WP_CONSTRAINT_TYPE_G_PROPERTY,
++ "bound-id", "=u", id, nullptr));
+
+- if (!proxy) {
++ if (proxy == nullptr) {
+ auto err = fmt::format("Object '{}' not found\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+ }
+
+ g_autoptr(WpProperties) properties =
+- WP_IS_PIPEWIRE_OBJECT(proxy) ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
+- : wp_properties_new_empty();
+- g_autoptr(WpProperties) global_p = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
++ WP_IS_PIPEWIRE_OBJECT(proxy) != 0
++ ? wp_pipewire_object_get_properties(WP_PIPEWIRE_OBJECT(proxy))
++ : wp_properties_new_empty();
++ g_autoptr(WpProperties) globalP = wp_global_proxy_get_global_properties(WP_GLOBAL_PROXY(proxy));
+ properties = wp_properties_ensure_unique_owner(properties);
+- wp_properties_add(properties, global_p);
+- wp_properties_set(properties, "object.id", NULL);
+- auto nick = wp_properties_get(properties, "node.nick");
+- auto description = wp_properties_get(properties, "node.description");
+-
+- self->node_name_ = nick ? nick : description ? description : "Unknown node name";
++ wp_properties_add(properties, globalP);
++ wp_properties_set(properties, "object.id", nullptr);
++ const auto* nick = wp_properties_get(properties, "node.nick");
++ const auto* description = wp_properties_get(properties, "node.description");
++
++ self->node_name_ = nick != nullptr ? nick
++ : description != nullptr ? description
++ : "Unknown node name";
+ spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_);
+ }
+
+ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* self, uint32_t id) {
+ spdlog::debug("[{}]: updating volume", self->name_);
+- GVariant* variant = NULL;
++ GVariant* variant = nullptr;
+
+ if (!isValidNodeId(id)) {
+ spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
+@@ -97,7 +94,7 @@ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* se
+
+ g_signal_emit_by_name(self->mixer_api_, "get-volume", id, &variant);
+
+- if (!variant) {
++ if (variant == nullptr) {
+ auto err = fmt::format("Node {} does not support volume\n", id);
+ spdlog::error("[{}]: {}", self->name_, err);
+ throw std::runtime_error(err);
+@@ -115,9 +112,9 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
+- self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++ self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
+ return;
+ }
+@@ -140,49 +137,49 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
+ void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
+ spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
+
+- uint32_t default_node_id;
+- g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id);
++ uint32_t defaultNodeId;
++ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &defaultNodeId);
+
+- if (!isValidNodeId(default_node_id)) {
++ if (!isValidNodeId(defaultNodeId)) {
+ spdlog::warn("[{}]: '{}' is not a valid node ID. Ignoring node change.", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+ g_autoptr(WpNode) node = static_cast<WpNode*>(
+ wp_object_manager_lookup(self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id",
+- "=u", default_node_id, NULL));
++ "=u", defaultNodeId, nullptr));
+
+- if (!node) {
++ if (node == nullptr) {
+ spdlog::warn("[{}]: (onDefaultNodesApiChanged) - Object with id {} not found", self->name_,
+- default_node_id);
++ defaultNodeId);
+ return;
+ }
+
+- const gchar* default_node_name =
++ const gchar* defaultNodeName =
+ wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name");
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - got the following default node: Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+- if (g_strcmp0(self->default_node_name_, default_node_name) == 0) {
++ if (g_strcmp0(self->default_node_name_, defaultNodeName) == 0) {
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node has not changed. Node(name: {}, id: {}). "
+ "Ignoring.",
+- self->name_, self->default_node_name_, default_node_id);
++ self->name_, self->default_node_name_, defaultNodeId);
+ return;
+ }
+
+ spdlog::debug(
+ "[{}]: (onDefaultNodesApiChanged) - Default node changed to -> Node(name: {}, id: {})",
+- self->name_, default_node_name, default_node_id);
++ self->name_, defaultNodeName, defaultNodeId);
+
+ g_free(self->default_node_name_);
+- self->default_node_name_ = g_strdup(default_node_name);
+- self->node_id_ = default_node_id;
+- updateVolume(self, default_node_id);
+- updateNodeName(self, default_node_id);
++ self->default_node_name_ = g_strdup(defaultNodeName);
++ self->node_id_ = defaultNodeId;
++ updateVolume(self, defaultNodeId);
++ updateNodeName(self, defaultNodeId);
+ }
+
+ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
+@@ -190,14 +187,14 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ self->def_nodes_api_ = wp_plugin_find(self->wp_core_, "default-nodes-api");
+
+- if (!self->def_nodes_api_) {
++ if (self->def_nodes_api_ == nullptr) {
+ spdlog::error("[{}]: default nodes api is not loaded.", self->name_);
+ throw std::runtime_error("Default nodes API is not loaded\n");
+ }
+
+ self->mixer_api_ = wp_plugin_find(self->wp_core_, "mixer-api");
+
+- if (!self->mixer_api_) {
++ if (self->mixer_api_ == nullptr) {
+ spdlog::error("[{}]: mixer api is not loaded.", self->name_);
+ throw std::runtime_error("Mixer api is not loaded\n");
+ }
+@@ -206,7 +203,7 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+ &self->default_node_name_);
+ g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_);
+
+- if (self->default_node_name_) {
++ if (self->default_node_name_ != nullptr) {
+ spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
+ self->name_, self->default_node_name_, self->node_id_);
+ }
+@@ -221,11 +218,11 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
+
+ void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
+ waybar::modules::Wireplumber* self) {
+- auto plugin_name = wp_plugin_get_name(WP_PLUGIN(p));
+- spdlog::debug("[{}]: onPluginActivated: {}", self->name_, plugin_name);
+- g_autoptr(GError) error = NULL;
++ const auto* pluginName = wp_plugin_get_name(WP_PLUGIN(p));
++ spdlog::debug("[{}]: onPluginActivated: {}", self->name_, pluginName);
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_object_activate_finish(p, res, &error)) {
++ if (wp_object_activate_finish(p, res, &error) == 0) {
+ spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
+ throw std::runtime_error(error->message);
+ }
+@@ -240,7 +237,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ for (uint16_t i = 0; i < apis_->len; i++) {
+ WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
+ pending_plugins_++;
+- wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, NULL,
++ wp_object_activate(WP_OBJECT(plugin), WP_PLUGIN_FEATURE_ENABLED, nullptr,
+ (GAsyncReadyCallback)onPluginActivated, this);
+ }
+ }
+@@ -248,34 +245,67 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ void waybar::modules::Wireplumber::prepare() {
+ spdlog::debug("[{}]: preparing object manager", name_);
+ wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
+- "=s", "Audio/Sink", NULL);
++ "=s", "Audio/Sink", nullptr);
+ }
+
+-void waybar::modules::Wireplumber::loadRequiredApiModules() {
+- spdlog::debug("[{}]: loading required modules", name_);
+- g_autoptr(GError) error = NULL;
++void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", NULL,
+- &error)) {
++ spdlog::debug("[{}]: callback loading default node api module", self->name_);
++
++ success = wp_core_load_component_finish(self->wp_core_, res, &error);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: default nodes API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
++ spdlog::debug("[{}]: loaded default nodes api", self->name_);
++ g_ptr_array_add(self->apis_, wp_plugin_find(self->wp_core_, "default-nodes-api"));
++
++ spdlog::debug("[{}]: loading mixer api module", self->name_);
++ wp_core_load_component(self->wp_core_, "libwireplumber-module-mixer-api", "module", nullptr,
++ "mixer-api", nullptr, (GAsyncReadyCallback)onMixerApiLoaded, self);
++}
+
+- if (!wp_core_load_component(wp_core_, "libwireplumber-module-mixer-api", "module", NULL,
+- &error)) {
++void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* res,
++ waybar::modules::Wireplumber* self) {
++ gboolean success = FALSE;
++ g_autoptr(GError) error = nullptr;
++
++ success = wp_core_load_component_finish(self->wp_core_, res, nullptr);
++
++ if (success == FALSE) {
++ spdlog::error("[{}]: mixer API load failed", self->name_);
+ throw std::runtime_error(error->message);
+ }
+
+- g_ptr_array_add(apis_, wp_plugin_find(wp_core_, "default-nodes-api"));
+- g_ptr_array_add(apis_, ({
+- WpPlugin* p = wp_plugin_find(wp_core_, "mixer-api");
+- g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, NULL);
++ spdlog::debug("[{}]: loaded mixer API", self->name_);
++ g_ptr_array_add(self->apis_, ({
++ WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
++ g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
+ p;
+ }));
++
++ self->activatePlugins();
++
++ self->dp.emit();
++
++ self->event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
++ self->event_box_.signal_scroll_event().connect(sigc::mem_fun(*self, &Wireplumber::handleScroll));
++}
++
++void waybar::modules::Wireplumber::asyncLoadRequiredApiModules() {
++ spdlog::debug("[{}]: loading default nodes api module", name_);
++ wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", nullptr,
++ "default-nodes-api", nullptr, (GAsyncReadyCallback)onDefaultNodesApiLoaded,
++ this);
+ }
+
+ auto waybar::modules::Wireplumber::update() -> void {
+ auto format = format_;
+- std::string tooltip_format;
++ std::string tooltipFormat;
+
+ if (muted_) {
+ format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
+@@ -292,12 +322,12 @@ auto waybar::modules::Wireplumber::update() -> void {
+ getState(vol);
+
+ if (tooltipEnabled()) {
+- if (tooltip_format.empty() && config_["tooltip-format"].isString()) {
+- tooltip_format = config_["tooltip-format"].asString();
++ if (tooltipFormat.empty() && config_["tooltip-format"].isString()) {
++ tooltipFormat = config_["tooltip-format"].asString();
+ }
+
+- if (!tooltip_format.empty()) {
+- label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format),
++ if (!tooltipFormat.empty()) {
++ label_.set_tooltip_text(fmt::format(fmt::runtime(tooltipFormat),
+ fmt::arg("node_name", node_name_),
+ fmt::arg("volume", vol), fmt::arg("icon", getIcon(vol))));
+ } else {
+@@ -317,31 +347,31 @@ bool waybar::modules::Wireplumber::handleScroll(GdkEventScroll* e) {
+ if (dir == SCROLL_DIR::NONE) {
+ return true;
+ }
+- double max_volume = 1;
++ double maxVolume = 1;
+ double step = 1.0 / 100.0;
+ if (config_["scroll-step"].isDouble()) {
+ step = config_["scroll-step"].asDouble() / 100.0;
+ }
+ if (config_["max-volume"].isDouble()) {
+- max_volume = config_["max-volume"].asDouble() / 100.0;
++ maxVolume = config_["max-volume"].asDouble() / 100.0;
+ }
+
+ if (step < min_step_) step = min_step_;
+
+- double new_vol = volume_;
++ double newVol = volume_;
+ if (dir == SCROLL_DIR::UP) {
+- if (volume_ < max_volume) {
+- new_vol = volume_ + step;
+- if (new_vol > max_volume) new_vol = max_volume;
++ if (volume_ < maxVolume) {
++ newVol = volume_ + step;
++ if (newVol > maxVolume) newVol = maxVolume;
+ }
+ } else if (dir == SCROLL_DIR::DOWN) {
+ if (volume_ > 0) {
+- new_vol = volume_ - step;
+- if (new_vol < 0) new_vol = 0;
++ newVol = volume_ - step;
++ if (newVol < 0) newVol = 0;
+ }
+ }
+- if (new_vol != volume_) {
+- GVariant* variant = g_variant_new_double(new_vol);
++ if (newVol != volume_) {
++ GVariant* variant = g_variant_new_double(newVol);
+ gboolean ret;
+ g_signal_emit_by_name(mixer_api_, "set-volume", node_id_, variant, &ret);
+ }
+
diff --git a/srcpkgs/Waybar/template b/srcpkgs/Waybar/template
index dae9e9bbce457b..14ca6e18282e76 100644
--- a/srcpkgs/Waybar/template
+++ b/srcpkgs/Waybar/template
@@ -1,7 +1,7 @@
# Template file for 'Waybar'
pkgname=Waybar
version=0.10.0
-revision=1
+revision=2
build_style=meson
configure_args="-Dlibudev=enabled -Dman-pages=enabled
-Dsystemd=disabled -Drfkill=enabled
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PR PATCH] [Merged]: wireplumber: update to 0.5.2; revbump Waybar
2024-03-23 22:38 [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar cinerea0
` (3 preceding siblings ...)
2024-04-22 15:38 ` cinerea0
@ 2024-04-22 16:16 ` cinerea0
4 siblings, 0 replies; 6+ messages in thread
From: cinerea0 @ 2024-04-22 16:16 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 247 bytes --]
There's a merged pull request on the void-packages repository
wireplumber: update to 0.5.2; revbump Waybar
https://github.com/void-linux/void-packages/pull/49490
Description:
#### Testing the changes
- I tested the changes in this PR: **YES**
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-22 16:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-23 22:38 [PR PATCH] wireplumber: update to 0.5.0; revbump Waybar cinerea0
2024-04-03 3:39 ` Luciogi
2024-04-03 14:51 ` [PR PATCH] [Updated] " cinerea0
2024-04-03 14:56 ` [PR PATCH] [Updated] wireplumber: update to 0.5.1; " cinerea0
2024-04-22 15:38 ` cinerea0
2024-04-22 16:16 ` [PR PATCH] [Merged]: wireplumber: update to 0.5.2; " cinerea0
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).