diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2023-06-27 09:37:17 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2023-06-27 13:25:39 +0200 |
commit | c0a7d151fc1ca3995f030daef0cb600549ac84b4 (patch) | |
tree | a7083b70e7f210008520a9c8e3ecf03dd15711b9 /kde-plasma | |
parent | kde-plasma/kwin: Backport various 5.27.7 fixes (diff) | |
download | gentoo-c0a7d151fc1ca3995f030daef0cb600549ac84b4.tar.gz gentoo-c0a7d151fc1ca3995f030daef0cb600549ac84b4.tar.bz2 gentoo-c0a7d151fc1ca3995f030daef0cb600549ac84b4.zip |
kde-plasma/plasma-pa: Backport various 5.27.7 fixes
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=435840
See also: https://invent.kde.org/plasma/plasma-pa/-/merge_requests/191
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-plasma')
3 files changed, 176 insertions, 0 deletions
diff --git a/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch b/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch new file mode 100644 index 000000000000..2067a4fd9742 --- /dev/null +++ b/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-make-setGenericVolume-keep-balance.patch @@ -0,0 +1,42 @@ +From ffe6a4f4b6f56296165cea8651f35563d168ac89 Mon Sep 17 00:00:00 2001 +From: Quinten Kock <quintenkock@gmail.com> +Date: Wed, 21 Jun 2023 20:51:11 +0200 +Subject: [PATCH] Make setGenericVolume keep balance between channels + +Previously setGenericVolume would apply the same amount of difference +on all channels, making e.g. 100%/50% -> 80%/30%. + +This commit changes it to keep the ratios equal instead, so that the +resulting volume would be 80%/40%, keeping the balance the same. + +BUG: 435840 +FIXED-IN: 5.27.7 + + +(cherry picked from commit cfe4a360f2640d7bd4e2d936804b100a299b268a) +--- + src/context.h | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/context.h b/src/context.h +index 3d1f7525..969fa13b 100644 +--- a/src/context.h ++++ b/src/context.h +@@ -123,9 +123,12 @@ public: + newVolume = qBound<qint64>(0, newVolume, PA_VOLUME_MAX); + pa_cvolume newCVolume = cVolume; + if (channel == -1) { // -1 all channels +- const qint64 diff = newVolume - pa_cvolume_max(&cVolume); ++ const qint64 orig = pa_cvolume_max(&cVolume); ++ const qint64 diff = newVolume - orig; + for (int i = 0; i < newCVolume.channels; ++i) { +- newCVolume.values[i] = qBound<qint64>(0, newCVolume.values[i] + diff, PA_VOLUME_MAX); ++ const qint64 channel = newCVolume.values[i]; ++ const qint64 channelDiff = orig == 0 ? diff : diff * channel / orig; ++ newCVolume.values[i] = qBound<qint64>(0, newCVolume.values[i] + channelDiff, PA_VOLUME_MAX); + } + } else { + Q_ASSERT(newCVolume.channels > channel); +-- +GitLab + diff --git a/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-move-volume-logic-to-VolumeSlider.patch b/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-move-volume-logic-to-VolumeSlider.patch new file mode 100644 index 000000000000..2a01651f8814 --- /dev/null +++ b/kde-plasma/plasma-pa/files/plasma-pa-5.27.6-move-volume-logic-to-VolumeSlider.patch @@ -0,0 +1,93 @@ +From 91dcf51a0cda029519c917c93f330a6ced531784 Mon Sep 17 00:00:00 2001 +From: Quinten Kock <quintenkock@gmail.com> +Date: Wed, 21 Jun 2023 21:03:15 +0200 +Subject: [PATCH] Put volume change logic centrally in VolumeSlider + +This commit puts the volume change logic in one place, to prevent +issues related to changing the volume twice. + +Without this commit there are issues such as dragging from 100%/100% to +100%/50% and then the mixer changing the volume to 50%/25%. + +I'm not sure I'm entirely happy with this, but it seems to work. + + +(cherry picked from commit fec28d12c086a13038f6c40f10d3c25bb7517660) +--- + src/kcm/package/contents/ui/DeviceListItem.qml | 18 ++---------------- + src/kcm/package/contents/ui/VolumeSlider.qml | 16 +++++++++++++++- + 2 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/src/kcm/package/contents/ui/DeviceListItem.qml b/src/kcm/package/contents/ui/DeviceListItem.qml +index 09feea71..ab0ce6f0 100644 +--- a/src/kcm/package/contents/ui/DeviceListItem.qml ++++ b/src/kcm/package/contents/ui/DeviceListItem.qml +@@ -178,12 +178,6 @@ ColumnLayout { + Layout.columnSpan: 2 + Layout.alignment: Qt.AlignVCenter + visible: !balanceButton.checked +- +- value: Volume +- onMoved: { +- Volume = value; +- Muted = (value === 0); +- } + } + + Repeater { +@@ -203,16 +197,8 @@ ColumnLayout { + Layout.fillWidth: true + + value: ChannelVolumes[index] +- onMoved: { +- delegate.pulseObject.setChannelVolume(index, value); +- +- // volumes are updated async, so we'll just assume it worked here +- let newChannelVolumes = ChannelVolumes; +- newChannelVolumes[index] = value; +- Muted = newChannelVolumes.every((volume) => { +- return volume === 0; +- }); +- } ++ ++ channel: index + } + } + } +diff --git a/src/kcm/package/contents/ui/VolumeSlider.qml b/src/kcm/package/contents/ui/VolumeSlider.qml +index c2cf0a31..fc0c4a6c 100644 +--- a/src/kcm/package/contents/ui/VolumeSlider.qml ++++ b/src/kcm/package/contents/ui/VolumeSlider.qml +@@ -19,6 +19,8 @@ RowLayout { + + property alias value: slider.value + ++ property int channel: -1 ++ + QQC2.Slider { + id: slider + +@@ -35,7 +37,19 @@ RowLayout { + onMoved: { + // Since it is not possible to use stepSize without tickmarks being displayed, force 1% steps + // Unfortunately without stepSize, it cannot snap visually whilst scrolling by changing value instead of Volume as it breaks the binding +- Volume = Math.round(value * 100 / PulseAudio.NormalVolume) * PulseAudio.NormalVolume / 100 ++ let volume = Math.round(value * 100 / PulseAudio.NormalVolume) * PulseAudio.NormalVolume / 100 ++ if (channel == -1) { ++ Volume = volume ++ Muted = volume === 0; ++ } else { ++ delegate.pulseObject.setChannelVolume(channel, volume); ++ ++ // volumes are updated async, so we'll just assume it worked here ++ let newChannelVolumes = ChannelVolumes; ++ newChannelVolumes[index] = value; ++ Muted = newChannelVolumes.every(volume => volume === 0); ++ } ++ + sliderRow.moved() + } + +-- +GitLab + diff --git a/kde-plasma/plasma-pa/plasma-pa-5.27.6-r1.ebuild b/kde-plasma/plasma-pa/plasma-pa-5.27.6-r1.ebuild new file mode 100644 index 000000000000..9128d7fa29b0 --- /dev/null +++ b/kde-plasma/plasma-pa/plasma-pa-5.27.6-r1.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_HANDBOOK="forceoptional" +KFMIN=5.106.0 +QTMIN=5.15.9 +inherit ecm plasma.kde.org + +DESCRIPTION="Plasma applet for audio volume management using PulseAudio" + +LICENSE="GPL-2" # TODO: CHECK +SLOT="5" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" +IUSE="" + +DEPEND=" + dev-libs/glib:2 + >=dev-qt/qtdbus-${QTMIN}:5 + >=dev-qt/qtdeclarative-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=kde-frameworks/kcoreaddons-${KFMIN}:5 + >=kde-frameworks/kdeclarative-${KFMIN}:5 + >=kde-frameworks/kglobalaccel-${KFMIN}:5 + >=kde-frameworks/ki18n-${KFMIN}:5 + >=kde-frameworks/plasma-${KFMIN}:5 + media-libs/libcanberra + media-libs/libpulse +" +RDEPEND="${DEPEND} + >=dev-qt/qtquickcontrols2-${QTMIN}:5 + >=kde-frameworks/kirigami-${KFMIN}:5 + x11-themes/sound-theme-freedesktop +" +BDEPEND=">=kde-frameworks/kcmutils-${KFMIN}:5" + +PATCHES=( # in 5.27.7: + "${FILESDIR}/${P}-make-setGenericVolume-keep-balance.patch" # KDE-bug 435840 + "${FILESDIR}/${P}-move-volume-logic-to-VolumeSlider.patch" +) |