Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-plasma/plasma-desktop/files/, kde-plasma/plasma-desktop/
Date: Tue, 18 Aug 2020 17:49:25
Message-Id: 1597772932.4a07df1811d1c9d10087b04ea4ef54b4d1670650.asturm@gentoo
1 commit: 4a07df1811d1c9d10087b04ea4ef54b4d1670650
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 18 17:23:02 2020 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 18 17:48:52 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a07df18
7
8 kde-plasma/plasma-desktop: Fix Fonts KCM w/ >=KF-5.68
9
10 See also: https://mail.kde.org/pipermail/distributions/2020-August/000450.html
11 KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=420287#c9
12 Package-Manager: Portage-3.0.3, Repoman-3.0.0
13 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
14
15 ...ma-desktop-5.18.5-fix-fonts-kcm-w-kf-5.68.patch | 166 +++++++++++++++++++++
16 .../plasma-desktop/plasma-desktop-5.18.5-r2.ebuild | 157 +++++++++++++++++++
17 2 files changed, 323 insertions(+)
18
19 diff --git a/kde-plasma/plasma-desktop/files/plasma-desktop-5.18.5-fix-fonts-kcm-w-kf-5.68.patch b/kde-plasma/plasma-desktop/files/plasma-desktop-5.18.5-fix-fonts-kcm-w-kf-5.68.patch
20 new file mode 100644
21 index 00000000000..bae49609e52
22 --- /dev/null
23 +++ b/kde-plasma/plasma-desktop/files/plasma-desktop-5.18.5-fix-fonts-kcm-w-kf-5.68.patch
24 @@ -0,0 +1,166 @@
25 +From e5e5f5ed51aadfac99bfbdf3d2db5be16a12443b Mon Sep 17 00:00:00 2001
26 +From: Ahmad Samir <a.samirh78@×××××.com>
27 +Date: Mon, 10 Aug 2020 13:50:36 +0200
28 +Subject: [PATCH] kcm_fonts: Make the font selection dialog select the correct
29 + "Regular"-like style
30 +
31 +Due to KConfig dropping QFont styleName property (for "Regular"-like font
32 +styles, see [1] for more details), the font selection dialog invoked by the
33 +KCM could end up selecting the wrong style; this change sets the appropriate
34 +"Regular" style on the QFont object before invoking the font selection dialog
35 +to fix/workaround the issue.
36 +
37 +Note that in Plasma master branch the issue is handled differently, since
38 +we switched from QFontDialog to KFontChooserDialog (the latter has that
39 +logic built-in).
40 +
41 +[1] https://phabricator.kde.org/D27735
42 +
43 +CCBUG: 420287
44 +---
45 + kcms/fonts/fonts.cpp | 61 +++++++++++++++++--
46 + kcms/fonts/fonts.h | 1 +
47 + kcms/fonts/package/contents/ui/FontWidget.qml | 7 +--
48 + kcms/fonts/package/contents/ui/main.qml | 4 +-
49 + 4 files changed, 61 insertions(+), 12 deletions(-)
50 +
51 +diff --git a/kcms/fonts/fonts.cpp b/kcms/fonts/fonts.cpp
52 +index f771f6e51..c2ccdf777 100644
53 +--- a/kcms/fonts/fonts.cpp
54 ++++ b/kcms/fonts/fonts.cpp
55 +@@ -53,23 +53,50 @@
56 + /**** DLL Interface ****/
57 + K_PLUGIN_FACTORY_WITH_JSON(KFontsFactory, "kcm_fonts.json", registerPlugin<KFonts>();)
58 +
59 ++// If the styleName property is empty, then we want to set it to
60 ++// the "Regular"-like style provided by the font, so that the font
61 ++// selection dialog selects the correct style from the available styles
62 ++// list; for more details see:
63 ++// https://phabricator.kde.org/D27735 and https://phabricator.kde.org/D27785
64 ++static QFont setRegularFontStyle(const QFont &font)
65 ++{
66 ++ if (!(font.styleName().isEmpty() && font.weight() == QFont::Normal)) {
67 ++ return font;
68 ++ }
69 ++
70 ++ QFont f(font);
71 ++ QFontDatabase fdb;
72 ++ const QStringList styles = fdb.styles(f.family());
73 ++ for (const QString &s : styles) {
74 ++ if (s == QLatin1String("Regular")
75 ++ || s == QLatin1String("Normal")
76 ++ || s == QLatin1String("Book")
77 ++ || s == QLatin1String("Roman")) {
78 ++ f.setStyleName(s);
79 ++ return f;
80 ++ }
81 ++ }
82 ++ return font;
83 ++}
84 ++
85 + //from KFontRequester
86 + // Determine if the font with given properties is available on the system,
87 + // otherwise find and return the best fitting combination.
88 + static QFont nearestExistingFont(const QFont &font)
89 + {
90 +- QFontDatabase dbase;
91 ++ QFont _font = setRegularFontStyle(font);
92 +
93 ++ QFontDatabase dbase;
94 + // Initialize font data according to given font object.
95 +- QString family = font.family();
96 +- QString style = dbase.styleString(font);
97 +- qreal size = font.pointSizeF();
98 ++ QString family = _font.family();
99 ++ QString style = dbase.styleString(_font);
100 ++ qreal size = _font.pointSizeF();
101 +
102 + // Check if the family exists.
103 + const QStringList families = dbase.families();
104 + if (!families.contains(family)) {
105 + // Chose another family.
106 +- family = QFontInfo(font).family(); // the nearest match
107 ++ family = QFontInfo(_font).family(); // the nearest match
108 + if (!families.contains(family)) {
109 + family = families.count() ? families.at(0) : QStringLiteral("fixed");
110 + }
111 +@@ -614,6 +641,30 @@ bool KFonts::isDefaults() const
112 + return m_fontAASettings->isDefaults();
113 + }
114 +
115 ++void KFonts::adjustFont(const QFont &font, const QString &category)
116 ++{
117 ++ QFont _font = setRegularFontStyle(font);
118 ++
119 ++ bool ok = false;
120 ++ QFont selFont = QFontDialog::getFont(&ok, _font, nullptr, i18n("Select Font"));
121 ++
122 ++ if (ok && !m_settings->isImmutable(category)) {
123 ++ if (category == QLatin1String("font")) {
124 ++ m_settings->setFont(selFont);
125 ++ } else if (category == QLatin1String("menuFont")) {
126 ++ m_settings->setMenuFont(selFont);
127 ++ } else if (category == QLatin1String("toolBarFont")) {
128 ++ m_settings->setToolBarFont(selFont);
129 ++ } else if (category == QLatin1String("activeFont")) {
130 ++ m_settings->setActiveFont(selFont);
131 ++ } else if (category == QLatin1String("smallestReadableFont")) {
132 ++ m_settings->setSmallestReadableFont(selFont);
133 ++ } else if (category == QLatin1String("fixed")) {
134 ++ m_settings->setFixed(selFont);
135 ++ }
136 ++ }
137 ++}
138 ++
139 + void KFonts::adjustAllFonts()
140 + {
141 + QFont font = m_settings->font();
142 +diff --git a/kcms/fonts/fonts.h b/kcms/fonts/fonts.h
143 +index 51ed2ab60..5959e1995 100644
144 +--- a/kcms/fonts/fonts.h
145 ++++ b/kcms/fonts/fonts.h
146 +@@ -153,6 +153,7 @@ public Q_SLOTS:
147 + void save() override;
148 + void defaults() override;
149 + Q_INVOKABLE void adjustAllFonts();
150 ++ Q_INVOKABLE void adjustFont(const QFont &font, const QString &category);
151 +
152 + Q_SIGNALS:
153 + void fontsHaveChanged();
154 +diff --git a/kcms/fonts/package/contents/ui/FontWidget.qml b/kcms/fonts/package/contents/ui/FontWidget.qml
155 +index b62dd3bf4..5a6be5128 100644
156 +--- a/kcms/fonts/package/contents/ui/FontWidget.qml
157 ++++ b/kcms/fonts/package/contents/ui/FontWidget.qml
158 +@@ -57,11 +57,8 @@ FocusScope {
159 + Kirigami.MnemonicData.enabled: false
160 + focus: true
161 + onClicked: {
162 +- fontDialog.adjustAllFonts = false;
163 +- fontDialog.currentCategory = root.category
164 +- fontDialog.font = root.font;
165 +- fontDialog.currentFont = root.font;
166 +- fontDialog.open()
167 ++ fontDialog.adjustAllFonts = false
168 ++ kcm.adjustFont(root.font, root.category)
169 + }
170 + QtControls.ToolTip {
171 + visible: parent.hovered
172 +diff --git a/kcms/fonts/package/contents/ui/main.qml b/kcms/fonts/package/contents/ui/main.qml
173 +index 4a99c043a..e51fb21ba 100644
174 +--- a/kcms/fonts/package/contents/ui/main.qml
175 ++++ b/kcms/fonts/package/contents/ui/main.qml
176 +@@ -264,9 +264,9 @@ KCM.SimpleKCM {
177 + property bool adjustAllFonts: false
178 + onAccepted: {
179 + if (adjustAllFonts) {
180 +- kcm.adjustAllFonts(font);
181 ++ kcm.adjustAllFonts()
182 + } else {
183 +- kcm.fontsSettings[currentCategory] = font;
184 ++ kcm.adjustFont(font, currentCategory)
185 + }
186 + }
187 + }
188 +--
189 +GitLab
190 +
191
192 diff --git a/kde-plasma/plasma-desktop/plasma-desktop-5.18.5-r2.ebuild b/kde-plasma/plasma-desktop/plasma-desktop-5.18.5-r2.ebuild
193 new file mode 100644
194 index 00000000000..5fa672f9e01
195 --- /dev/null
196 +++ b/kde-plasma/plasma-desktop/plasma-desktop-5.18.5-r2.ebuild
197 @@ -0,0 +1,157 @@
198 +# Copyright 1999-2020 Gentoo Authors
199 +# Distributed under the terms of the GNU General Public License v2
200 +
201 +EAPI=7
202 +
203 +ECM_HANDBOOK="forceoptional"
204 +ECM_TEST="true"
205 +KFMIN=5.66.0
206 +PVCUT=$(ver_cut 1-3)
207 +QTMIN=5.12.3
208 +VIRTUALX_REQUIRED="test"
209 +inherit ecm kde.org
210 +
211 +DESCRIPTION="KDE Plasma desktop"
212 +XORGHDRS="${PN}-override-include-dirs-0"
213 +SRC_URI+=" https://dev.gentoo.org/~asturm/distfiles/${XORGHDRS}.tar.xz"
214 +
215 +LICENSE="GPL-2" # TODO: CHECK
216 +SLOT="5"
217 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
218 +IUSE="+fontconfig ibus scim +semantic-desktop"
219 +
220 +COMMON_DEPEND="
221 + >=dev-qt/qtconcurrent-${QTMIN}:5
222 + >=dev-qt/qtdbus-${QTMIN}:5
223 + >=dev-qt/qtdeclarative-${QTMIN}:5
224 + >=dev-qt/qtgui-${QTMIN}:5
225 + >=dev-qt/qtnetwork-${QTMIN}:5
226 + >=dev-qt/qtprintsupport-${QTMIN}:5
227 + >=dev-qt/qtsql-${QTMIN}:5
228 + >=dev-qt/qtsvg-${QTMIN}:5
229 + >=dev-qt/qtwidgets-${QTMIN}:5
230 + >=dev-qt/qtx11extras-${QTMIN}:5
231 + >=dev-qt/qtxml-${QTMIN}:5
232 + >=kde-frameworks/attica-${KFMIN}:5
233 + >=kde-frameworks/kactivities-${KFMIN}:5
234 + >=kde-frameworks/kactivities-stats-${KFMIN}:5
235 + >=kde-frameworks/karchive-${KFMIN}:5
236 + >=kde-frameworks/kauth-${KFMIN}:5
237 + >=kde-frameworks/kbookmarks-${KFMIN}:5
238 + >=kde-frameworks/kcmutils-${KFMIN}:5
239 + >=kde-frameworks/kcodecs-${KFMIN}:5
240 + >=kde-frameworks/kcompletion-${KFMIN}:5
241 + >=kde-frameworks/kconfig-${KFMIN}:5
242 + >=kde-frameworks/kconfigwidgets-${KFMIN}:5
243 + >=kde-frameworks/kcoreaddons-${KFMIN}:5
244 + >=kde-frameworks/kdbusaddons-${KFMIN}:5
245 + >=kde-frameworks/kdeclarative-${KFMIN}:5
246 + >=kde-frameworks/kded-${KFMIN}:5
247 + >=kde-frameworks/kdelibs4support-${KFMIN}:5
248 + >=kde-frameworks/kemoticons-${KFMIN}:5
249 + >=kde-frameworks/kglobalaccel-${KFMIN}:5
250 + >=kde-frameworks/kguiaddons-${KFMIN}:5
251 + >=kde-frameworks/ki18n-${KFMIN}:5
252 + >=kde-frameworks/kiconthemes-${KFMIN}:5
253 + >=kde-frameworks/kio-${KFMIN}:5
254 + >=kde-frameworks/kitemmodels-${KFMIN}:5
255 + >=kde-frameworks/kitemviews-${KFMIN}:5
256 + >=kde-frameworks/kjobwidgets-${KFMIN}:5
257 + >=kde-frameworks/knewstuff-${KFMIN}:5
258 + >=kde-frameworks/knotifications-${KFMIN}:5
259 + >=kde-frameworks/knotifyconfig-${KFMIN}:5
260 + >=kde-frameworks/kparts-${KFMIN}:5
261 + >=kde-frameworks/krunner-${KFMIN}:5
262 + >=kde-frameworks/kservice-${KFMIN}:5
263 + >=kde-frameworks/kwallet-${KFMIN}:5
264 + >=kde-frameworks/kwidgetsaddons-${KFMIN}:5
265 + >=kde-frameworks/kwindowsystem-${KFMIN}:5
266 + >=kde-frameworks/kxmlgui-${KFMIN}:5
267 + >=kde-frameworks/plasma-${KFMIN}:5
268 + >=kde-frameworks/solid-${KFMIN}:5
269 + >=kde-frameworks/sonnet-${KFMIN}:5
270 + >=kde-plasma/kwin-${PVCUT}:5
271 + >=kde-plasma/libksysguard-${PVCUT}:5
272 + >=kde-plasma/plasma-workspace-${PVCUT}:5
273 + media-libs/phonon[qt5(+)]
274 + x11-libs/libX11
275 + x11-libs/libXcursor
276 + x11-libs/libXfixes
277 + x11-libs/libXi
278 + x11-libs/libxcb[xkb]
279 + x11-libs/libxkbfile
280 + fontconfig? (
281 + media-libs/fontconfig
282 + media-libs/freetype
283 + x11-libs/libXft
284 + x11-libs/xcb-util-image
285 + )
286 + ibus? (
287 + app-i18n/ibus
288 + dev-libs/glib:2
289 + >=dev-qt/qtx11extras-${QTMIN}:5
290 + x11-libs/libxcb
291 + x11-libs/xcb-util-keysyms
292 + )
293 + scim? ( app-i18n/scim )
294 + semantic-desktop? ( >=kde-frameworks/baloo-${KFMIN}:5 )
295 +"
296 +DEPEND="${COMMON_DEPEND}
297 + dev-libs/boost
298 + x11-base/xorg-proto
299 + fontconfig? ( x11-libs/libXrender )
300 +"
301 +RDEPEND="${COMMON_DEPEND}
302 + >=dev-qt/qtgraphicaleffects-${QTMIN}:5
303 + >=dev-qt/qtquickcontrols2-${QTMIN}:5
304 + >=kde-frameworks/kirigami-${KFMIN}:5
305 + >=kde-frameworks/qqc2-desktop-style-${KFMIN}:5
306 + >=kde-plasma/breeze-${PVCUT}:5
307 + >=kde-plasma/kde-cli-tools-${PVCUT}:5
308 + >=kde-plasma/oxygen-${PVCUT}:5
309 + sys-apps/util-linux
310 + x11-apps/setxkbmap
311 + !<kde-plasma/kdeplasma-addons-5.15.80
312 +"
313 +
314 +PATCHES=(
315 + "${FILESDIR}/${PN}-5.18.4.1-synaptics-header.patch" # in Plasma/5.19
316 + "${FILESDIR}/${P}-findxorgserver.patch" # in Plasma/5.19
317 + "${WORKDIR}/${XORGHDRS}/override-include-dirs.patch" # downstream patch
318 +
319 + "${FILESDIR}/${P}-KColorSchemeEditor-blurry-icons.patch" # in Plasma/5.18
320 + "${FILESDIR}/${P}-fix-fonts-kcm-w-kf-5.68.patch" # in Plasma/5.18
321 +
322 + # Fix animation duration w/ KDE Frameworks 5.70 (Plasma/5.19 backports):
323 + # https://pointieststick.com/2020/05/10/why-the-animations-in-your-plasma-5-18-feel-slow-now-and-when-it-will-be-fixed/
324 + "${FILESDIR}/${P}-fix-animate-in-animation.patch"
325 + "${FILESDIR}/${P}-animate-column-moves.patch"
326 + "${FILESDIR}/${P}-stop-multiplying-duration-values.patch"
327 +)
328 +
329 +src_configure() {
330 + local mycmakeargs=(
331 + $(cmake_use_find_package fontconfig Fontconfig)
332 + -DEvdev_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include
333 + -DXORGLIBINPUT_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include
334 + -DXORGSERVER_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include
335 + -DSynaptics_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include
336 + $(cmake_use_find_package ibus IBus)
337 + $(cmake_use_find_package scim SCIM)
338 + $(cmake_use_find_package semantic-desktop KF5Baloo)
339 + )
340 +
341 + ecm_src_configure
342 +}
343 +
344 +src_test() {
345 + # parallel tests fail, foldermodeltest,positionertest hang, bug #646890
346 + # test_kio_fonts needs D-Bus, bug #634166
347 + # lookandfeel-kcmTest is unreliable for a long time, bug #607918
348 + local myctestargs=(
349 + -j1
350 + -E "(foldermodeltest|positionertest|test_kio_fonts|lookandfeel-kcmTest)"
351 + )
352 +
353 + ecm_src_test
354 +}