commit:     c5b3d781b1ae2869a602906d0df470616d9d39d5
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 22 23:09:28 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Nov 22 23:12:00 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5b3d781

kde-frameworks/qqc2-desktop-style: Qt text rendering w highDPI scaling

Upstream commit e82957f5e6fc72e446239e2ee5139b93d3ceac85

See also:
https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/429

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=479891

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...tyle-6.7.0-use-qt-textrendering-w-highdpi.patch | 53 ++++++++++++++++++++++
 .../qqc2-desktop-style-6.7.0-r1.ebuild             | 40 ++++++++++++++++
 .../qqc2-desktop-style-6.8.0-r1.ebuild             | 40 ++++++++++++++++
 3 files changed, 133 insertions(+)

diff --git 
a/kde-frameworks/qqc2-desktop-style/files/qqc2-desktop-style-6.7.0-use-qt-textrendering-w-highdpi.patch
 
b/kde-frameworks/qqc2-desktop-style/files/qqc2-desktop-style-6.7.0-use-qt-textrendering-w-highdpi.patch
new file mode 100644
index 000000000000..251e9d3728f6
--- /dev/null
+++ 
b/kde-frameworks/qqc2-desktop-style/files/qqc2-desktop-style-6.7.0-use-qt-textrendering-w-highdpi.patch
@@ -0,0 +1,53 @@
+From e82957f5e6fc72e446239e2ee5139b93d3ceac85 Mon Sep 17 00:00:00 2001
+From: David Edmundson <[email protected]>
+Date: Fri, 22 Nov 2024 21:57:01 +0000
+Subject: [PATCH] Use Qt text rendering when high DPI scaling
+
+It is known that native rendering performs badly with scaling and an
+existing workaround is in place.
+
+The current check does not work on Wayland that has per-window rather
+than per-screen scaling. Given Qt changes hinting preferences when any
+scaling is used anyway, we may as well commit to using the non-native
+rendering throughout.
+
+For QtQuick the Qt renderer is more performant, handles transformations
+better and avoids this issue. Given the results look basically
+identical, we can simplify the existing code.
+
+BUG: 479891
+---
+ .../plasmadesktoptheme.cpp                      | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp 
b/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp
+index 51a3241f..fac0831f 100644
+--- a/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp
++++ b/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp
+@@ -50,14 +50,15 @@ public:
+         connect(qGuiApp, &QGuiApplication::fontDatabaseChanged, this, 
&StyleSingleton::notifyWatchersConfigurationChange);
+         qGuiApp->installEventFilter(this);
+ 
+-        // Use NativeTextRendering as the default text rendering type when 
the scale factor is an integer.
+-        // NativeTextRendering is still distorted sometimes with fractional 
scale factors,
+-        // despite https://bugreports.qt.io/browse/QTBUG-67007 being closed.
+-        qreal devicePixelRatio = qGuiApp->devicePixelRatio();
+-        QQuickWindow::TextRenderType defaultTextRenderType =
+-            int(devicePixelRatio) == devicePixelRatio ? 
QQuickWindow::NativeTextRendering : QQuickWindow::QtTextRendering;
+-        QQuickWindow::setTextRenderType(defaultTextRenderType);
+-
++        // NativeTextRendering is still distorted sometimes with fractional 
scale factors
++        // Given Qt disables all hinting with native rendering when any 
scaling is used anyway
++        // we can use Qt's rendering throughout
++        // QTBUG-126577
++        if (qApp->devicePixelRatio() == 1.0) {
++            
QQuickWindow::setTextRenderType(QQuickWindow::NativeTextRendering);
++        } else {
++            QQuickWindow::setTextRenderType(QQuickWindow::QtTextRendering);
++        }
+         smallFont = loadSmallFont();
+     }
+ 
+-- 
+GitLab
+

diff --git 
a/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-6.7.0-r1.ebuild 
b/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-6.7.0-r1.ebuild
new file mode 100644
index 000000000000..66285380137c
--- /dev/null
+++ b/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-6.7.0-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_QTHELP="false"
+PVCUT=$(ver_cut 1-2)
+QTMIN=6.6.2
+inherit ecm frameworks.kde.org
+
+DESCRIPTION="Style for QtQuickControls 2 that uses QWidget's QStyle for 
painting"
+
+LICENSE="|| ( GPL-2+ LGPL-3+ )"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+IUSE=""
+
+# Qt_6_PRIVATE_API matches org.kde.desktop.so, see also:
+# https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/379
+DEPEND="
+       >=dev-qt/qtbase-${QTMIN}:6[dbus,gui,widgets]
+       >=dev-qt/qtdeclarative-${QTMIN}:6=
+       =kde-frameworks/kcolorscheme-${PVCUT}*:6
+       =kde-frameworks/kconfig-${PVCUT}*:6
+       =kde-frameworks/kiconthemes-${PVCUT}*:6
+       =kde-frameworks/kirigami-${PVCUT}*:6
+       =kde-frameworks/sonnet-${PVCUT}*:6[qml]
+"
+RDEPEND="${DEPEND}
+       >=dev-qt/qt5compat-${QTMIN}:6
+"
+BDEPEND=">=dev-qt/qttools-${QTMIN}:6[linguist]"
+
+PATCHES=(
+       "${FILESDIR}/${P}-use-qt-textrendering-w-highdpi.patch" # KDE-bug 
#479891
+)
+
+CMAKE_SKIP_TESTS=(
+       # bug 926509
+       animationspeedmodifiertest
+)

diff --git 
a/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-6.8.0-r1.ebuild 
b/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-6.8.0-r1.ebuild
new file mode 100644
index 000000000000..f63d2fa1dfd0
--- /dev/null
+++ b/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-6.8.0-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+ECM_QTHELP="false"
+PVCUT=$(ver_cut 1-2)
+QTMIN=6.7.2
+inherit ecm frameworks.kde.org
+
+DESCRIPTION="Style for QtQuickControls 2 that uses QWidget's QStyle for 
painting"
+
+LICENSE="|| ( GPL-2+ LGPL-3+ )"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+IUSE=""
+
+# Qt_6_PRIVATE_API matches org.kde.desktop.so, see also:
+# https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/379
+DEPEND="
+       >=dev-qt/qtbase-${QTMIN}:6[dbus,gui,widgets]
+       >=dev-qt/qtdeclarative-${QTMIN}:6=
+       =kde-frameworks/kcolorscheme-${PVCUT}*:6
+       =kde-frameworks/kconfig-${PVCUT}*:6
+       =kde-frameworks/kiconthemes-${PVCUT}*:6
+       =kde-frameworks/kirigami-${PVCUT}*:6
+       =kde-frameworks/sonnet-${PVCUT}*:6[qml]
+"
+RDEPEND="${DEPEND}
+       >=dev-qt/qt5compat-${QTMIN}:6
+"
+BDEPEND=">=dev-qt/qttools-${QTMIN}:6[linguist]"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-6.7.0-use-qt-textrendering-w-highdpi.patch" # 
KDE-bug #479891
+)
+
+CMAKE_SKIP_TESTS=(
+       # bug 926509
+       animationspeedmodifiertest
+)

Reply via email to