- Update waybar-build-for-wireplumber-0.5.patch to current version.
Remove URL so we need to manually update in case it changes again. See Alexays/Waybar#2919 OBS-URL: https://build.opensuse.org/package/show/X11:Wayland/waybar?expand=0&rev=126
This commit is contained in:
parent
d9a673ff6c
commit
b7617df1da
@ -1,30 +1,22 @@
|
|||||||
From 70de2fb8b2123a042ace28346d8ad1885e9acfe5 Mon Sep 17 00:00:00 2001
|
From 2326727ccbf0456ccfd631e748955f7f67c44a4e Mon Sep 17 00:00:00 2001
|
||||||
From: Ryan Walklin <ryan@testtoast.com>
|
From: Ryan Walklin <ryan@testtoast.com>
|
||||||
Date: Thu, 15 Feb 2024 09:37:36 +1300
|
Date: Thu, 15 Feb 2024 09:37:36 +1300
|
||||||
Subject: [PATCH 1/3] Update Wireplumber API to 0.5
|
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.
|
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 | 7 ++-
|
include/modules/wireplumber.hpp | 5 +-
|
||||||
meson.build | 2 +-
|
meson.build | 2 +-
|
||||||
src/modules/wireplumber.cpp | 78 ++++++++++++++++++++++-----------
|
src/modules/wireplumber.cpp | 190 ++++++++++++++++++--------------
|
||||||
3 files changed, 59 insertions(+), 28 deletions(-)
|
3 files changed, 115 insertions(+), 82 deletions(-)
|
||||||
|
|
||||||
diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
|
diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
|
||||||
index 9bbf4d464..50121424b 100644
|
index 9bbf4d464..6255b95fd 100644
|
||||||
--- a/include/modules/wireplumber.hpp
|
--- a/include/modules/wireplumber.hpp
|
||||||
+++ b/include/modules/wireplumber.hpp
|
+++ b/include/modules/wireplumber.hpp
|
||||||
@@ -3,6 +3,9 @@
|
@@ -17,12 +17,15 @@ class Wireplumber : public ALabel {
|
||||||
#include <fmt/format.h>
|
|
||||||
#include <wp/wp.h>
|
|
||||||
|
|
||||||
+#define WP_LOCAL_LOG_TOPIC wp_waybar
|
|
||||||
+WP_LOG_TOPIC_EXTERN (wp_waybar)
|
|
||||||
+
|
|
||||||
#include <algorithm>
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
@@ -17,12 +20,14 @@ class Wireplumber : public ALabel {
|
|
||||||
auto update() -> void override;
|
auto update() -> void override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -35,7 +27,8 @@ index 9bbf4d464..50121424b 100644
|
|||||||
static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
|
static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
|
||||||
static void updateNodeName(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 onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
|
||||||
+ static void onDefaultNodesApiLoaded(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 onMixerApiLoaded(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
|
||||||
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
|
static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
|
||||||
static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
|
static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
|
||||||
@ -54,7 +47,7 @@ index e21ff262c..120976083 100644
|
|||||||
libsndio = compiler.find_library('sndio', required: get_option('sndio'))
|
libsndio = compiler.find_library('sndio', required: get_option('sndio'))
|
||||||
if libsndio.found()
|
if libsndio.found()
|
||||||
diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
|
diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
|
||||||
index 51bb708d1..021160168 100644
|
index 51bb708d1..bd019b623 100644
|
||||||
--- a/src/modules/wireplumber.cpp
|
--- a/src/modules/wireplumber.cpp
|
||||||
+++ b/src/modules/wireplumber.cpp
|
+++ b/src/modules/wireplumber.cpp
|
||||||
@@ -18,31 +18,24 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
|
@@ -18,31 +18,24 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
|
||||||
@ -62,7 +55,7 @@ index 51bb708d1..021160168 100644
|
|||||||
node_id_(0) {
|
node_id_(0) {
|
||||||
wp_init(WP_INIT_PIPEWIRE);
|
wp_init(WP_INIT_PIPEWIRE);
|
||||||
- wp_core_ = wp_core_new(NULL, NULL);
|
- wp_core_ = wp_core_new(NULL, NULL);
|
||||||
+ wp_core_ = wp_core_new(NULL, NULL, NULL);
|
+ wp_core_ = wp_core_new(nullptr, nullptr, nullptr);
|
||||||
apis_ = g_ptr_array_new_with_free_func(g_object_unref);
|
apis_ = g_ptr_array_new_with_free_func(g_object_unref);
|
||||||
om_ = wp_object_manager_new();
|
om_ = wp_object_manager_new();
|
||||||
|
|
||||||
@ -95,145 +88,7 @@ index 51bb708d1..021160168 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
waybar::modules::Wireplumber::~Wireplumber() {
|
waybar::modules::Wireplumber::~Wireplumber() {
|
||||||
@@ -251,26 +244,59 @@ void waybar::modules::Wireplumber::prepare() {
|
@@ -63,32 +56,36 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
|
||||||
"=s", "Audio/Sink", NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
-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;
|
|
||||||
+
|
|
||||||
+ spdlog::debug("[{}]: callback loading default node api module", self->name_);
|
|
||||||
|
|
||||||
- if (!wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", NULL,
|
|
||||||
- &error)) {
|
|
||||||
+
|
|
||||||
+ 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);
|
|
||||||
- p;
|
|
||||||
- }));
|
|
||||||
+ 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 {
|
|
||||||
|
|
||||||
From 2aa6b862c51b2f71eb6688a7aff6f8f42f524923 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Ryan Walklin <ryan@testtoast.com>
|
|
||||||
Date: Wed, 20 Mar 2024 14:10:21 +1300
|
|
||||||
Subject: [PATCH 2/3] Remove WP_LOCAL_LOG_TOPIC - this was required for
|
|
||||||
0.4.81-0.4.90, but fixed for 0.5.0
|
|
||||||
|
|
||||||
See https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/e9d8eeedefa8adf47646ab9375c8888506f143e6
|
|
||||||
---
|
|
||||||
include/modules/wireplumber.hpp | 3 ---
|
|
||||||
1 file changed, 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
|
|
||||||
index 50121424b..aa6e96ec1 100644
|
|
||||||
--- a/include/modules/wireplumber.hpp
|
|
||||||
+++ b/include/modules/wireplumber.hpp
|
|
||||||
@@ -3,9 +3,6 @@
|
|
||||||
#include <fmt/format.h>
|
|
||||||
#include <wp/wp.h>
|
|
||||||
|
|
||||||
-#define WP_LOCAL_LOG_TOPIC wp_waybar
|
|
||||||
-WP_LOG_TOPIC_EXTERN (wp_waybar)
|
|
||||||
-
|
|
||||||
#include <algorithm>
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
|
|
||||||
From 19f792a3e43c8351c8eb7368e60bf3763ca56df1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Ryan Walklin <ryan@testtoast.com>
|
|
||||||
Date: Wed, 20 Mar 2024 14:12:48 +1300
|
|
||||||
Subject: [PATCH 3/3] 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 | 3 +-
|
|
||||||
src/modules/wireplumber.cpp | 132 ++++++++++++++++----------------
|
|
||||||
2 files changed, 70 insertions(+), 65 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
|
|
||||||
index aa6e96ec1..6255b95fd 100644
|
|
||||||
--- a/include/modules/wireplumber.hpp
|
|
||||||
+++ b/include/modules/wireplumber.hpp
|
|
||||||
@@ -23,7 +23,8 @@ class Wireplumber : public ALabel {
|
|
||||||
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 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);
|
|
||||||
diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
|
|
||||||
index 021160168..bd019b623 100644
|
|
||||||
--- a/src/modules/wireplumber.cpp
|
|
||||||
+++ b/src/modules/wireplumber.cpp
|
|
||||||
@@ -18,7 +18,7 @@ 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, 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();
|
|
||||||
|
|
||||||
@@ -56,32 +56,36 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +138,7 @@ index 021160168..bd019b623 100644
|
|||||||
|
|
||||||
if (!isValidNodeId(id)) {
|
if (!isValidNodeId(id)) {
|
||||||
spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
|
spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
|
||||||
@@ -90,7 +94,7 @@ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* se
|
@@ -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);
|
g_signal_emit_by_name(self->mixer_api_, "get-volume", id, &variant);
|
||||||
|
|
||||||
@ -292,7 +147,7 @@ index 021160168..bd019b623 100644
|
|||||||
auto err = fmt::format("Node {} does not support volume\n", id);
|
auto err = fmt::format("Node {} does not support volume\n", id);
|
||||||
spdlog::error("[{}]: {}", self->name_, err);
|
spdlog::error("[{}]: {}", self->name_, err);
|
||||||
throw std::runtime_error(err);
|
throw std::runtime_error(err);
|
||||||
@@ -108,9 +112,9 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
|
@@ -115,9 +112,9 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
|
||||||
spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
|
spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
|
||||||
|
|
||||||
g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
|
g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
|
||||||
@ -304,7 +159,7 @@ index 021160168..bd019b623 100644
|
|||||||
spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
|
spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -133,49 +137,49 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
|
@@ -140,49 +137,49 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber*
|
||||||
void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
|
void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
|
||||||
spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
|
spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
|
||||||
|
|
||||||
@ -370,7 +225,7 @@ index 021160168..bd019b623 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
|
void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
|
||||||
@@ -183,14 +187,14 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
|
@@ -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");
|
self->def_nodes_api_ = wp_plugin_find(self->wp_core_, "default-nodes-api");
|
||||||
|
|
||||||
@ -387,7 +242,7 @@ index 021160168..bd019b623 100644
|
|||||||
spdlog::error("[{}]: mixer api is not loaded.", self->name_);
|
spdlog::error("[{}]: mixer api is not loaded.", self->name_);
|
||||||
throw std::runtime_error("Mixer api is not loaded\n");
|
throw std::runtime_error("Mixer api is not loaded\n");
|
||||||
}
|
}
|
||||||
@@ -199,7 +203,7 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
|
@@ -206,7 +203,7 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
|
||||||
&self->default_node_name_);
|
&self->default_node_name_);
|
||||||
g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_);
|
g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_);
|
||||||
|
|
||||||
@ -396,7 +251,7 @@ index 021160168..bd019b623 100644
|
|||||||
spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
|
spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
|
||||||
self->name_, self->default_node_name_, self->node_id_);
|
self->name_, self->default_node_name_, self->node_id_);
|
||||||
}
|
}
|
||||||
@@ -214,11 +218,11 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
|
@@ -221,11 +218,11 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir
|
||||||
|
|
||||||
void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
|
void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
|
||||||
waybar::modules::Wireplumber* self) {
|
waybar::modules::Wireplumber* self) {
|
||||||
@ -412,7 +267,7 @@ index 021160168..bd019b623 100644
|
|||||||
spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
|
spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
|
||||||
throw std::runtime_error(error->message);
|
throw std::runtime_error(error->message);
|
||||||
}
|
}
|
||||||
@@ -233,7 +237,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
|
@@ -240,7 +237,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
|
||||||
for (uint16_t i = 0; i < apis_->len; i++) {
|
for (uint16_t i = 0; i < apis_->len; i++) {
|
||||||
WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
|
WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
|
||||||
pending_plugins_++;
|
pending_plugins_++;
|
||||||
@ -421,7 +276,7 @@ index 021160168..bd019b623 100644
|
|||||||
(GAsyncReadyCallback)onPluginActivated, this);
|
(GAsyncReadyCallback)onPluginActivated, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +245,7 @@ void waybar::modules::Wireplumber::activatePlugins() {
|
@@ -248,34 +245,67 @@ void waybar::modules::Wireplumber::activatePlugins() {
|
||||||
void waybar::modules::Wireplumber::prepare() {
|
void waybar::modules::Wireplumber::prepare() {
|
||||||
spdlog::debug("[{}]: preparing object manager", name_);
|
spdlog::debug("[{}]: preparing object manager", name_);
|
||||||
wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
|
wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
|
||||||
@ -429,44 +284,68 @@ index 021160168..bd019b623 100644
|
|||||||
+ "=s", "Audio/Sink", nullptr);
|
+ "=s", "Audio/Sink", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncResult* res,
|
-void waybar::modules::Wireplumber::loadRequiredApiModules() {
|
||||||
@@ -251,7 +255,6 @@ void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncRe
|
- 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;
|
||||||
|
|
||||||
spdlog::debug("[{}]: callback loading default node api module", self->name_);
|
- 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);
|
+
|
||||||
|
+ success = wp_core_load_component_finish(self->wp_core_, res, &error);
|
||||||
if (success == FALSE) {
|
+
|
||||||
@@ -263,7 +266,7 @@ void waybar::modules::Wireplumber::onDefaultNodesApiLoaded(WpObject* p, GAsyncRe
|
+ if (success == FALSE) {
|
||||||
|
+ spdlog::error("[{}]: default nodes API load failed", self->name_);
|
||||||
spdlog::debug("[{}]: loading mixer api module", self->name_);
|
throw std::runtime_error(error->message);
|
||||||
wp_core_load_component(self->wp_core_, "libwireplumber-module-mixer-api", "module", nullptr,
|
}
|
||||||
- "mixer-api", nullptr, (GAsyncReadyCallback)onMixerApiLoaded, self);
|
+ 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);
|
+ "mixer-api", nullptr, (GAsyncReadyCallback)onMixerApiLoaded, self);
|
||||||
}
|
+}
|
||||||
|
|
||||||
void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* res,
|
- if (!wp_core_load_component(wp_core_, "libwireplumber-module-mixer-api", "module", NULL,
|
||||||
@@ -280,10 +283,10 @@ void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* r
|
- &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);
|
||||||
|
}
|
||||||
|
|
||||||
spdlog::debug("[{}]: loaded mixer API", self->name_);
|
- g_ptr_array_add(apis_, wp_plugin_find(wp_core_, "default-nodes-api"));
|
||||||
g_ptr_array_add(self->apis_, ({
|
- g_ptr_array_add(apis_, ({
|
||||||
- WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
|
- WpPlugin* p = wp_plugin_find(wp_core_, "mixer-api");
|
||||||
- g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
|
- g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, NULL);
|
||||||
- p;
|
+ spdlog::debug("[{}]: loaded mixer API", self->name_);
|
||||||
- }));
|
+ g_ptr_array_add(self->apis_, ({
|
||||||
+ WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
|
+ WpPlugin* p = wp_plugin_find(self->wp_core_, "mixer-api");
|
||||||
+ g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
|
+ g_object_set(G_OBJECT(p), "scale", 1 /* cubic */, nullptr);
|
||||||
+ p;
|
p;
|
||||||
+ }));
|
}));
|
||||||
|
+
|
||||||
self->activatePlugins();
|
+ self->activatePlugins();
|
||||||
|
+
|
||||||
@@ -296,12 +299,13 @@ void waybar::modules::Wireplumber::onMixerApiLoaded(WpObject* p, GAsyncResult* r
|
+ self->dp.emit();
|
||||||
void waybar::modules::Wireplumber::asyncLoadRequiredApiModules() {
|
+
|
||||||
spdlog::debug("[{}]: loading default nodes api module", name_);
|
+ self->event_box_.add_events(Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
|
||||||
wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", nullptr,
|
+ self->event_box_.signal_scroll_event().connect(sigc::mem_fun(*self, &Wireplumber::handleScroll));
|
||||||
- "default-nodes-api", nullptr, (GAsyncReadyCallback)onDefaultNodesApiLoaded, this);
|
+}
|
||||||
|
+
|
||||||
|
+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,
|
+ "default-nodes-api", nullptr, (GAsyncReadyCallback)onDefaultNodesApiLoaded,
|
||||||
+ this);
|
+ this);
|
||||||
}
|
}
|
||||||
@ -478,7 +357,7 @@ index 021160168..bd019b623 100644
|
|||||||
|
|
||||||
if (muted_) {
|
if (muted_) {
|
||||||
format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
|
format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
|
||||||
@@ -318,12 +322,12 @@ auto waybar::modules::Wireplumber::update() -> void {
|
@@ -292,12 +322,12 @@ auto waybar::modules::Wireplumber::update() -> void {
|
||||||
getState(vol);
|
getState(vol);
|
||||||
|
|
||||||
if (tooltipEnabled()) {
|
if (tooltipEnabled()) {
|
||||||
@ -495,7 +374,7 @@ index 021160168..bd019b623 100644
|
|||||||
fmt::arg("node_name", node_name_),
|
fmt::arg("node_name", node_name_),
|
||||||
fmt::arg("volume", vol), fmt::arg("icon", getIcon(vol))));
|
fmt::arg("volume", vol), fmt::arg("icon", getIcon(vol))));
|
||||||
} else {
|
} else {
|
||||||
@@ -343,31 +347,31 @@ bool waybar::modules::Wireplumber::handleScroll(GdkEventScroll* e) {
|
@@ -317,31 +347,31 @@ bool waybar::modules::Wireplumber::handleScroll(GdkEventScroll* e) {
|
||||||
if (dir == SCROLL_DIR::NONE) {
|
if (dir == SCROLL_DIR::NONE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Mar 21 11:36:46 UTC 2024 - Michael Vetter <mvetter@suse.com>
|
||||||
|
|
||||||
|
- Update waybar-build-for-wireplumber-0.5.patch to current version.
|
||||||
|
Remove URL so we need to manually update in case it changes again.
|
||||||
|
See Alexays/Waybar#2919
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Mar 20 22:03:05 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
|
Wed Mar 20 22:03:05 UTC 2024 - Joshua Smith <smolsheep@opensuse.org>
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ Group: System/GUI/Other
|
|||||||
URL: https://github.com/Alexays/Waybar
|
URL: https://github.com/Alexays/Waybar
|
||||||
Source0: https://github.com/Alexays/Waybar/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
Source0: https://github.com/Alexays/Waybar/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
Source1: waybar.rpmlintrc
|
Source1: waybar.rpmlintrc
|
||||||
# PATCH-FIX-UPSTREAM waybar-build-for-wireplumber-0.5.patch -- resolving wireplumber build
|
# PATCH-FIX-UPSTREAM smolsheep@opensuse.org -- Fix wireplumber build. See gh/Alexays/Waybar#2919
|
||||||
Patch0: %{url}/pull/2919.patch#/%{name}-build-for-wireplumber-0.5.patch
|
Patch0: waybar-build-for-wireplumber-0.5.patch
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
%if 0%{?sle_version} >= 150400
|
%if 0%{?sle_version} >= 150400
|
||||||
BuildRequires: gcc13-c++
|
BuildRequires: gcc13-c++
|
||||||
|
Loading…
Reference in New Issue
Block a user