From 106080a94a4b292b4c82340082b2190184688f608727430789e40de1f22a8b4a Mon Sep 17 00:00:00 2001 From: Christophe Marin Date: Tue, 1 Aug 2023 20:14:15 +0000 Subject: [PATCH] Accepting request 1101852 from home:Vogtinator:plasma5.27 - Add patch to fix line wrapping of "100 %" in OSDs (kde#469576): * 0001-OSD-Fix-size-calculation-for-progress-value.patch OBS-URL: https://build.opensuse.org/request/show/1101852 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/plasma5-workspace?expand=0&rev=705 --- ...-size-calculation-for-progress-value.patch | 63 +++++++++++++++++++ plasma5-workspace.changes | 6 ++ plasma5-workspace.spec | 2 + 3 files changed, 71 insertions(+) create mode 100644 0001-OSD-Fix-size-calculation-for-progress-value.patch diff --git a/0001-OSD-Fix-size-calculation-for-progress-value.patch b/0001-OSD-Fix-size-calculation-for-progress-value.patch new file mode 100644 index 0000000..b73476b --- /dev/null +++ b/0001-OSD-Fix-size-calculation-for-progress-value.patch @@ -0,0 +1,63 @@ +From 94b2c3d1d4a72d70d487513954601c2cf723e673 Mon Sep 17 00:00:00 2001 +From: Kai Uwe Broulik +Date: Tue, 1 Aug 2023 19:47:52 +0200 +Subject: [PATCH] OSD: Fix size calculation for progress value + +Use a common function for formatting the percent, so placeholder 100% label will +use the exact formatting used by the label next to the progress bar. + +Also use font advanceWidth, which is the appropriate means of calculating the +bounding box of text in this case. Also ceil it to avoid subpixel alignment. + +And to be absolutely sure disable word wrapping. + +BUG: 469576 +(cherry picked from commit 9737efa79440b65db303030f34f0039f1c9cd6a0) +--- + lookandfeel/org.kde.breeze/contents/osd/OsdItem.qml | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/lookandfeel/org.kde.breeze/contents/osd/OsdItem.qml b/lookandfeel/org.kde.breeze/contents/osd/OsdItem.qml +index fa892cb23..bc60efc15 100644 +--- a/lookandfeel/org.kde.breeze/contents/osd/OsdItem.qml ++++ b/lookandfeel/org.kde.breeze/contents/osd/OsdItem.qml +@@ -26,6 +26,10 @@ RowLayout { + // false for displaying the value as normal text + property bool showingProgress: false + ++ function formatPercent(number) { ++ return i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Percentage value", "%1%", number); ++ } ++ + spacing: PlasmaCore.Units.smallSpacing + + Layout.preferredWidth: Math.max(Math.min(Screen.desktopAvailableWidth / 2, implicitWidth), PlasmaCore.Units.gridUnit * 15) +@@ -63,7 +67,7 @@ RowLayout { + // to the maximum width to avoid the progress bad resizing itself + TextMetrics { + id: widestLabelSize +- text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "100%") ++ text: formatPercent(100) + font: percentageLabel.font + } + +@@ -71,13 +75,14 @@ RowLayout { + PlasmaExtra.Heading { + id: percentageLabel + Layout.fillHeight: true +- Layout.preferredWidth: widestLabelSize.width ++ Layout.preferredWidth: Math.ceil(widestLabelSize.advanceWidth) + Layout.rightMargin: PlasmaCore.Units.smallSpacing + Layout.alignment: Qt.AlignVCenter + level: 3 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter +- text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Percentage value", "%1%", progressBar.value) ++ text: formatPercent(progressBar.value) ++ wrapMode: Text.NoWrap + visible: showingProgress + // Display a subtle visual indication that the volume might be + // dangerously high +-- +2.41.0 + diff --git a/plasma5-workspace.changes b/plasma5-workspace.changes index 81b61d5..0edfe10 100644 --- a/plasma5-workspace.changes +++ b/plasma5-workspace.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 1 20:07:29 UTC 2023 - Fabian Vogt + +- Add patch to fix line wrapping of "100 %" in OSDs (kde#469576): + * 0001-OSD-Fix-size-calculation-for-progress-value.patch + ------------------------------------------------------------------- Tue Aug 1 11:19:31 UTC 2023 - Fabian Vogt diff --git a/plasma5-workspace.spec b/plasma5-workspace.spec index 71d6686..5498ed0 100644 --- a/plasma5-workspace.spec +++ b/plasma5-workspace.spec @@ -42,6 +42,8 @@ Source1: https://download.kde.org/stable/plasma/%{version}/plasma-workspa Source2: plasma.keyring %endif Source3: xprop-kde-full-session.desktop +# PATCH-FIX-UPSTREAM +Patch1: 0001-OSD-Fix-size-calculation-for-progress-value.patch # PATCHES 501-??? are PATCH-FIX-OPENSUSE Patch501: 0001-Use-qdbus-qt5.patch Patch502: 0001-Ignore-default-sddm-face-icons.patch