[packages/pavucontrol] use canberra only in x11 (fixes crashes in wayland); rel 3

atler atler at pld-linux.org
Fri Jul 28 03:39:05 CEST 2023


commit aa55e289adc742979788ff6731042004561c201c
Author: Jan Palus <atler at pld-linux.org>
Date:   Fri Jul 28 01:48:42 2023 +0200

    use canberra only in x11 (fixes crashes in wayland); rel 3
    
    long obsolete libcanberra is x11 exclusive so check in code whether
    we're dealing with x11 before invoking any canberra api

 no-canberra-in-wayland.patch | 80 ++++++++++++++++++++++++++++++++++++++++++++
 pavucontrol.spec             |  4 ++-
 2 files changed, 83 insertions(+), 1 deletion(-)
---
diff --git a/pavucontrol.spec b/pavucontrol.spec
index f1880f4..a46a28e 100644
--- a/pavucontrol.spec
+++ b/pavucontrol.spec
@@ -2,11 +2,12 @@ Summary:	PulseAudio Volume Control
 Summary(pl.UTF-8):	PulseAudio Volume Control - sterowanie głośnością PulseAudio
 Name:		pavucontrol
 Version:	5.0
-Release:	2
+Release:	3
 License:	GPL v2+
 Group:		X11/Applications/Sound
 Source0:	https://freedesktop.org/software/pulseaudio/pavucontrol/%{name}-%{version}.tar.xz
 # Source0-md5:	a4a5dc51dcf4d912443faf3fe8d32b55
+Patch0:		no-canberra-in-wayland.patch
 URL:		https://freedesktop.org/software/pulseaudio/pavucontrol/
 BuildRequires:	autoconf >= 2.62
 BuildRequires:	automake >= 1:1.11
@@ -41,6 +42,7 @@ strumienia osobno.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %{__intltoolize}
diff --git a/no-canberra-in-wayland.patch b/no-canberra-in-wayland.patch
new file mode 100644
index 0000000..ad98a19
--- /dev/null
+++ b/no-canberra-in-wayland.patch
@@ -0,0 +1,80 @@
+diff -ur pavucontrol-5.0.orig/src/pavucontrol.cc pavucontrol-5.0/src/pavucontrol.cc
+--- pavucontrol-5.0.orig/src/pavucontrol.cc	2021-08-15 19:06:48.000000000 +0200
++++ pavucontrol-5.0/src/pavucontrol.cc	2023-07-28 01:39:00.243215086 +0200
+@@ -45,6 +45,8 @@
+ #include "mainwindow.h"
+ #include "pavuapplication.h"
+ 
++#include <gdk/gdkx.h>
++
+ #include <unordered_map>
+ #include <utility>
+ #include <memory>
+@@ -916,10 +918,12 @@
+     tab_number = _tab_number;
+     retry = _retry;
+ 
+-    ca_context_set_driver(ca_gtk_context_get(), "pulse");
+-
+     mainWindow = MainWindow::create(maximize);
+ 
++    if (GDK_IS_X11_WINDOW(mainWindow->gobj())) {
++        ca_context_set_driver(ca_gtk_context_get(), "pulse");
++    }
++
+     api = pa_glib_mainloop_get_api(m);
+     g_assert(api);
+ 
+diff -ur pavucontrol-5.0.orig/src/sinkwidget.cc pavucontrol-5.0/src/sinkwidget.cc
+--- pavucontrol-5.0.orig/src/sinkwidget.cc	2021-08-15 19:06:48.000000000 +0200
++++ pavucontrol-5.0/src/sinkwidget.cc	2023-07-28 01:35:42.425595898 +0200
+@@ -32,6 +32,9 @@
+ 
+ #include "i18n.h"
+ 
++#include <gdk/gdkx.h>
++
++
+ SinkWidget::SinkWidget(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x) :
+     DeviceWidget(cobject, x) {
+ #if HAVE_EXT_DEVICE_RESTORE_API
+@@ -98,22 +101,24 @@
+ 
+     pa_operation_unref(o);
+ 
+-    ca_context_playing(ca_gtk_context_get(), 2, &playing);
+-    if (playing)
+-        return;
+-
+-    snprintf(dev, sizeof(dev), "%lu", (unsigned long) index);
+-    ca_context_change_device(ca_gtk_context_get(), dev);
+-
+-    ca_gtk_play_for_widget(GTK_WIDGET(gobj()),
+-                           2,
+-                           CA_PROP_EVENT_DESCRIPTION, _("Volume Control Feedback Sound"),
+-                           CA_PROP_EVENT_ID, "audio-volume-change",
+-                           CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
+-                           CA_PROP_CANBERRA_ENABLE, "1",
+-                           NULL);
++    if (GDK_IS_X11_DISPLAY(this->get_display()->gobj())) {
++        ca_context_playing(ca_gtk_context_get(), 2, &playing);
++        if (playing)
++            return;
++
++        snprintf(dev, sizeof(dev), "%lu", (unsigned long) index);
++        ca_context_change_device(ca_gtk_context_get(), dev);
++
++        ca_gtk_play_for_widget(GTK_WIDGET(gobj()),
++                               2,
++                               CA_PROP_EVENT_DESCRIPTION, _("Volume Control Feedback Sound"),
++                               CA_PROP_EVENT_ID, "audio-volume-change",
++                               CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
++                               CA_PROP_CANBERRA_ENABLE, "1",
++                               NULL);
+ 
+-    ca_context_change_device(ca_gtk_context_get(), NULL);
++        ca_context_change_device(ca_gtk_context_get(), NULL);
++    }
+ }
+ 
+ void SinkWidget::onMuteToggleButton() {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pavucontrol.git/commitdiff/aa55e289adc742979788ff6731042004561c201c



More information about the pld-cvs-commit mailing list