diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2020-08-18 19:23:02 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2020-08-18 19:48:52 +0200 |
commit | 4a07df1811d1c9d10087b04ea4ef54b4d1670650 (patch) | |
tree | d7d7b91512798debe5fb83edfc77c3ad5d515639 /kde-plasma/plasma-desktop | |
parent | sci-geosciences/qgis: 3.10.9 version bump (diff) | |
download | gentoo-4a07df1811d1c9d10087b04ea4ef54b4d1670650.tar.gz gentoo-4a07df1811d1c9d10087b04ea4ef54b4d1670650.tar.bz2 gentoo-4a07df1811d1c9d10087b04ea4ef54b4d1670650.zip |
kde-plasma/plasma-desktop: Fix Fonts KCM w/ >=KF-5.68
See also: https://mail.kde.org/pipermail/distributions/2020-August/000450.html
KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=420287#c9
Package-Manager: Portage-3.0.3, Repoman-3.0.0
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-plasma/plasma-desktop')
-rw-r--r-- | kde-plasma/plasma-desktop/files/plasma-desktop-5.18.5-fix-fonts-kcm-w-kf-5.68.patch | 166 | ||||
-rw-r--r-- | kde-plasma/plasma-desktop/plasma-desktop-5.18.5-r2.ebuild | 157 |
2 files changed, 323 insertions, 0 deletions
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 new file mode 100644 index 000000000000..bae49609e52f --- /dev/null +++ b/kde-plasma/plasma-desktop/files/plasma-desktop-5.18.5-fix-fonts-kcm-w-kf-5.68.patch @@ -0,0 +1,166 @@ +From e5e5f5ed51aadfac99bfbdf3d2db5be16a12443b Mon Sep 17 00:00:00 2001 +From: Ahmad Samir <a.samirh78@gmail.com> +Date: Mon, 10 Aug 2020 13:50:36 +0200 +Subject: [PATCH] kcm_fonts: Make the font selection dialog select the correct + "Regular"-like style + +Due to KConfig dropping QFont styleName property (for "Regular"-like font +styles, see [1] for more details), the font selection dialog invoked by the +KCM could end up selecting the wrong style; this change sets the appropriate +"Regular" style on the QFont object before invoking the font selection dialog +to fix/workaround the issue. + +Note that in Plasma master branch the issue is handled differently, since +we switched from QFontDialog to KFontChooserDialog (the latter has that +logic built-in). + +[1] https://phabricator.kde.org/D27735 + +CCBUG: 420287 +--- + kcms/fonts/fonts.cpp | 61 +++++++++++++++++-- + kcms/fonts/fonts.h | 1 + + kcms/fonts/package/contents/ui/FontWidget.qml | 7 +-- + kcms/fonts/package/contents/ui/main.qml | 4 +- + 4 files changed, 61 insertions(+), 12 deletions(-) + +diff --git a/kcms/fonts/fonts.cpp b/kcms/fonts/fonts.cpp +index f771f6e51..c2ccdf777 100644 +--- a/kcms/fonts/fonts.cpp ++++ b/kcms/fonts/fonts.cpp +@@ -53,23 +53,50 @@ + /**** DLL Interface ****/ + K_PLUGIN_FACTORY_WITH_JSON(KFontsFactory, "kcm_fonts.json", registerPlugin<KFonts>();) + ++// If the styleName property is empty, then we want to set it to ++// the "Regular"-like style provided by the font, so that the font ++// selection dialog selects the correct style from the available styles ++// list; for more details see: ++// https://phabricator.kde.org/D27735 and https://phabricator.kde.org/D27785 ++static QFont setRegularFontStyle(const QFont &font) ++{ ++ if (!(font.styleName().isEmpty() && font.weight() == QFont::Normal)) { ++ return font; ++ } ++ ++ QFont f(font); ++ QFontDatabase fdb; ++ const QStringList styles = fdb.styles(f.family()); ++ for (const QString &s : styles) { ++ if (s == QLatin1String("Regular") ++ || s == QLatin1String("Normal") ++ || s == QLatin1String("Book") ++ || s == QLatin1String("Roman")) { ++ f.setStyleName(s); ++ return f; ++ } ++ } ++ return font; ++} ++ + //from KFontRequester + // Determine if the font with given properties is available on the system, + // otherwise find and return the best fitting combination. + static QFont nearestExistingFont(const QFont &font) + { +- QFontDatabase dbase; ++ QFont _font = setRegularFontStyle(font); + ++ QFontDatabase dbase; + // Initialize font data according to given font object. +- QString family = font.family(); +- QString style = dbase.styleString(font); +- qreal size = font.pointSizeF(); ++ QString family = _font.family(); ++ QString style = dbase.styleString(_font); ++ qreal size = _font.pointSizeF(); + + // Check if the family exists. + const QStringList families = dbase.families(); + if (!families.contains(family)) { + // Chose another family. +- family = QFontInfo(font).family(); // the nearest match ++ family = QFontInfo(_font).family(); // the nearest match + if (!families.contains(family)) { + family = families.count() ? families.at(0) : QStringLiteral("fixed"); + } +@@ -614,6 +641,30 @@ bool KFonts::isDefaults() const + return m_fontAASettings->isDefaults(); + } + ++void KFonts::adjustFont(const QFont &font, const QString &category) ++{ ++ QFont _font = setRegularFontStyle(font); ++ ++ bool ok = false; ++ QFont selFont = QFontDialog::getFont(&ok, _font, nullptr, i18n("Select Font")); ++ ++ if (ok && !m_settings->isImmutable(category)) { ++ if (category == QLatin1String("font")) { ++ m_settings->setFont(selFont); ++ } else if (category == QLatin1String("menuFont")) { ++ m_settings->setMenuFont(selFont); ++ } else if (category == QLatin1String("toolBarFont")) { ++ m_settings->setToolBarFont(selFont); ++ } else if (category == QLatin1String("activeFont")) { ++ m_settings->setActiveFont(selFont); ++ } else if (category == QLatin1String("smallestReadableFont")) { ++ m_settings->setSmallestReadableFont(selFont); ++ } else if (category == QLatin1String("fixed")) { ++ m_settings->setFixed(selFont); ++ } ++ } ++} ++ + void KFonts::adjustAllFonts() + { + QFont font = m_settings->font(); +diff --git a/kcms/fonts/fonts.h b/kcms/fonts/fonts.h +index 51ed2ab60..5959e1995 100644 +--- a/kcms/fonts/fonts.h ++++ b/kcms/fonts/fonts.h +@@ -153,6 +153,7 @@ public Q_SLOTS: + void save() override; + void defaults() override; + Q_INVOKABLE void adjustAllFonts(); ++ Q_INVOKABLE void adjustFont(const QFont &font, const QString &category); + + Q_SIGNALS: + void fontsHaveChanged(); +diff --git a/kcms/fonts/package/contents/ui/FontWidget.qml b/kcms/fonts/package/contents/ui/FontWidget.qml +index b62dd3bf4..5a6be5128 100644 +--- a/kcms/fonts/package/contents/ui/FontWidget.qml ++++ b/kcms/fonts/package/contents/ui/FontWidget.qml +@@ -57,11 +57,8 @@ FocusScope { + Kirigami.MnemonicData.enabled: false + focus: true + onClicked: { +- fontDialog.adjustAllFonts = false; +- fontDialog.currentCategory = root.category +- fontDialog.font = root.font; +- fontDialog.currentFont = root.font; +- fontDialog.open() ++ fontDialog.adjustAllFonts = false ++ kcm.adjustFont(root.font, root.category) + } + QtControls.ToolTip { + visible: parent.hovered +diff --git a/kcms/fonts/package/contents/ui/main.qml b/kcms/fonts/package/contents/ui/main.qml +index 4a99c043a..e51fb21ba 100644 +--- a/kcms/fonts/package/contents/ui/main.qml ++++ b/kcms/fonts/package/contents/ui/main.qml +@@ -264,9 +264,9 @@ KCM.SimpleKCM { + property bool adjustAllFonts: false + onAccepted: { + if (adjustAllFonts) { +- kcm.adjustAllFonts(font); ++ kcm.adjustAllFonts() + } else { +- kcm.fontsSettings[currentCategory] = font; ++ kcm.adjustFont(font, currentCategory) + } + } + } +-- +GitLab + 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 new file mode 100644 index 000000000000..5fa672f9e019 --- /dev/null +++ b/kde-plasma/plasma-desktop/plasma-desktop-5.18.5-r2.ebuild @@ -0,0 +1,157 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +ECM_HANDBOOK="forceoptional" +ECM_TEST="true" +KFMIN=5.66.0 +PVCUT=$(ver_cut 1-3) +QTMIN=5.12.3 +VIRTUALX_REQUIRED="test" +inherit ecm kde.org + +DESCRIPTION="KDE Plasma desktop" +XORGHDRS="${PN}-override-include-dirs-0" +SRC_URI+=" https://dev.gentoo.org/~asturm/distfiles/${XORGHDRS}.tar.xz" + +LICENSE="GPL-2" # TODO: CHECK +SLOT="5" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" +IUSE="+fontconfig ibus scim +semantic-desktop" + +COMMON_DEPEND=" + >=dev-qt/qtconcurrent-${QTMIN}:5 + >=dev-qt/qtdbus-${QTMIN}:5 + >=dev-qt/qtdeclarative-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtnetwork-${QTMIN}:5 + >=dev-qt/qtprintsupport-${QTMIN}:5 + >=dev-qt/qtsql-${QTMIN}:5 + >=dev-qt/qtsvg-${QTMIN}:5 + >=dev-qt/qtwidgets-${QTMIN}:5 + >=dev-qt/qtx11extras-${QTMIN}:5 + >=dev-qt/qtxml-${QTMIN}:5 + >=kde-frameworks/attica-${KFMIN}:5 + >=kde-frameworks/kactivities-${KFMIN}:5 + >=kde-frameworks/kactivities-stats-${KFMIN}:5 + >=kde-frameworks/karchive-${KFMIN}:5 + >=kde-frameworks/kauth-${KFMIN}:5 + >=kde-frameworks/kbookmarks-${KFMIN}:5 + >=kde-frameworks/kcmutils-${KFMIN}:5 + >=kde-frameworks/kcodecs-${KFMIN}:5 + >=kde-frameworks/kcompletion-${KFMIN}:5 + >=kde-frameworks/kconfig-${KFMIN}:5 + >=kde-frameworks/kconfigwidgets-${KFMIN}:5 + >=kde-frameworks/kcoreaddons-${KFMIN}:5 + >=kde-frameworks/kdbusaddons-${KFMIN}:5 + >=kde-frameworks/kdeclarative-${KFMIN}:5 + >=kde-frameworks/kded-${KFMIN}:5 + >=kde-frameworks/kdelibs4support-${KFMIN}:5 + >=kde-frameworks/kemoticons-${KFMIN}:5 + >=kde-frameworks/kglobalaccel-${KFMIN}:5 + >=kde-frameworks/kguiaddons-${KFMIN}:5 + >=kde-frameworks/ki18n-${KFMIN}:5 + >=kde-frameworks/kiconthemes-${KFMIN}:5 + >=kde-frameworks/kio-${KFMIN}:5 + >=kde-frameworks/kitemmodels-${KFMIN}:5 + >=kde-frameworks/kitemviews-${KFMIN}:5 + >=kde-frameworks/kjobwidgets-${KFMIN}:5 + >=kde-frameworks/knewstuff-${KFMIN}:5 + >=kde-frameworks/knotifications-${KFMIN}:5 + >=kde-frameworks/knotifyconfig-${KFMIN}:5 + >=kde-frameworks/kparts-${KFMIN}:5 + >=kde-frameworks/krunner-${KFMIN}:5 + >=kde-frameworks/kservice-${KFMIN}:5 + >=kde-frameworks/kwallet-${KFMIN}:5 + >=kde-frameworks/kwidgetsaddons-${KFMIN}:5 + >=kde-frameworks/kwindowsystem-${KFMIN}:5 + >=kde-frameworks/kxmlgui-${KFMIN}:5 + >=kde-frameworks/plasma-${KFMIN}:5 + >=kde-frameworks/solid-${KFMIN}:5 + >=kde-frameworks/sonnet-${KFMIN}:5 + >=kde-plasma/kwin-${PVCUT}:5 + >=kde-plasma/libksysguard-${PVCUT}:5 + >=kde-plasma/plasma-workspace-${PVCUT}:5 + media-libs/phonon[qt5(+)] + x11-libs/libX11 + x11-libs/libXcursor + x11-libs/libXfixes + x11-libs/libXi + x11-libs/libxcb[xkb] + x11-libs/libxkbfile + fontconfig? ( + media-libs/fontconfig + media-libs/freetype + x11-libs/libXft + x11-libs/xcb-util-image + ) + ibus? ( + app-i18n/ibus + dev-libs/glib:2 + >=dev-qt/qtx11extras-${QTMIN}:5 + x11-libs/libxcb + x11-libs/xcb-util-keysyms + ) + scim? ( app-i18n/scim ) + semantic-desktop? ( >=kde-frameworks/baloo-${KFMIN}:5 ) +" +DEPEND="${COMMON_DEPEND} + dev-libs/boost + x11-base/xorg-proto + fontconfig? ( x11-libs/libXrender ) +" +RDEPEND="${COMMON_DEPEND} + >=dev-qt/qtgraphicaleffects-${QTMIN}:5 + >=dev-qt/qtquickcontrols2-${QTMIN}:5 + >=kde-frameworks/kirigami-${KFMIN}:5 + >=kde-frameworks/qqc2-desktop-style-${KFMIN}:5 + >=kde-plasma/breeze-${PVCUT}:5 + >=kde-plasma/kde-cli-tools-${PVCUT}:5 + >=kde-plasma/oxygen-${PVCUT}:5 + sys-apps/util-linux + x11-apps/setxkbmap + !<kde-plasma/kdeplasma-addons-5.15.80 +" + +PATCHES=( + "${FILESDIR}/${PN}-5.18.4.1-synaptics-header.patch" # in Plasma/5.19 + "${FILESDIR}/${P}-findxorgserver.patch" # in Plasma/5.19 + "${WORKDIR}/${XORGHDRS}/override-include-dirs.patch" # downstream patch + + "${FILESDIR}/${P}-KColorSchemeEditor-blurry-icons.patch" # in Plasma/5.18 + "${FILESDIR}/${P}-fix-fonts-kcm-w-kf-5.68.patch" # in Plasma/5.18 + + # Fix animation duration w/ KDE Frameworks 5.70 (Plasma/5.19 backports): + # https://pointieststick.com/2020/05/10/why-the-animations-in-your-plasma-5-18-feel-slow-now-and-when-it-will-be-fixed/ + "${FILESDIR}/${P}-fix-animate-in-animation.patch" + "${FILESDIR}/${P}-animate-column-moves.patch" + "${FILESDIR}/${P}-stop-multiplying-duration-values.patch" +) + +src_configure() { + local mycmakeargs=( + $(cmake_use_find_package fontconfig Fontconfig) + -DEvdev_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include + -DXORGLIBINPUT_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include + -DXORGSERVER_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include + -DSynaptics_INCLUDE_DIRS="${WORKDIR}/${XORGHDRS}"/include + $(cmake_use_find_package ibus IBus) + $(cmake_use_find_package scim SCIM) + $(cmake_use_find_package semantic-desktop KF5Baloo) + ) + + ecm_src_configure +} + +src_test() { + # parallel tests fail, foldermodeltest,positionertest hang, bug #646890 + # test_kio_fonts needs D-Bus, bug #634166 + # lookandfeel-kcmTest is unreliable for a long time, bug #607918 + local myctestargs=( + -j1 + -E "(foldermodeltest|positionertest|test_kio_fonts|lookandfeel-kcmTest)" + ) + + ecm_src_test +} |