From: tunefish777 <tunefish777@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] kiconthemes: added patch for icon rendering issues
Date: Tue, 06 Apr 2021 13:35:28 +0200 [thread overview]
Message-ID: <20210406113528.LgatInKtaeN_BN5iAqbHeyNPEbfxrZi7E6pSxuP2OfQ@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-29949@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]
There is an updated pull request by tunefish777 against master on the void-packages repository
https://github.com/tunefish777/void-packages master
https://github.com/void-linux/void-packages/pull/29949
kiconthemes: added patch for icon rendering issues
<!-- Mark items with [x] where applicable -->
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)
#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR
<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
- [ ] aarch64-musl
- [ ] armv7l
- [ ] armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/29949.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29949.patch --]
[-- Type: text/x-diff, Size: 13598 bytes --]
From cbded82703d03060f5ea1120a1bdb3c8ece960f8 Mon Sep 17 00:00:00 2001
From: Moritz Waser <moritz.waser@student.tugraz.at>
Date: Fri, 2 Apr 2021 13:49:23 +0200
Subject: [PATCH] kiconthemes: added patch for icon rendering issues
---
.../patches/qdir_searchpath_for_icons.patch | 327 ++++++++++++++++++
srcpkgs/kiconthemes/template | 3 +-
2 files changed, 329 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/kiconthemes/patches/qdir_searchpath_for_icons.patch
diff --git a/srcpkgs/kiconthemes/patches/qdir_searchpath_for_icons.patch b/srcpkgs/kiconthemes/patches/qdir_searchpath_for_icons.patch
new file mode 100644
index 000000000000..cd776b6d8f29
--- /dev/null
+++ b/srcpkgs/kiconthemes/patches/qdir_searchpath_for_icons.patch
@@ -0,0 +1,327 @@
+From 49bdb6310194cd899641b7d9cf8463d4fba6baea Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Thu, 18 Mar 2021 10:18:17 +0100
+Subject: [PATCH 1/6] ensure qrc + QDir::searchPaths work for icons
+
+before we had some optimization to check which paths
+are absolute, but that one is wrong, applications
+might rely on set search paths
+
+BUG: 434451
+---
+ src/kiconloader.cpp | 19 ++++---------------
+ 1 file changed, 4 insertions(+), 15 deletions(-)
+
+diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
+index 011a292..2411af1 100644
+--- a/src/kiconloader.cpp
++++ b/src/kiconloader.cpp
+@@ -92,19 +92,6 @@ color:%7;\
+ }
+ }
+
+-/**
+- * Checks for relative paths quickly on UNIX-alikes, slowly on everything else.
+- */
+-static bool pathIsRelative(const QString &path)
+-{
+-#ifdef Q_OS_UNIX
+- // catch both /xxx/yyy and :/xxx/yyy for resources
+- return (!path.isEmpty() && path[0] != QLatin1Char('/') && path[0] != QLatin1Char(':'));
+-#else
+- return QDir::isRelativePath(path);
+-#endif
+-}
+-
+ /**
+ * Holds a QPixmap for this process, along with its associated path on disk.
+ */
+@@ -1214,7 +1201,8 @@ QString KIconLoader::iconPath(const QString &_name, int group_or_size, bool canR
+ return QString();
+ }
+
+- if (_name.isEmpty() || !pathIsRelative(_name)) {
++ // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isRelativePath, see bug 434451
++ if (_name.isEmpty() || !QDir::isRelativePath(_name)) {
+ // we have either an absolute path or nothing to work with
+ return _name;
+ }
+@@ -1352,7 +1340,8 @@ QPixmap KIconLoader::loadScaledIcon(const QString &_name,
+ name = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1Char('/') + name + QStringLiteral(".png");
+ }
+
+- bool absolutePath = !pathIsRelative(name);
++ // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isRelativePath, see bug 434451
++ bool absolutePath = !QDir::isRelativePath(name);
+ if (!absolutePath) {
+ name = d->removeIconExtension(name);
+ }
+--
+GitLab
+
+
+From 7cf21cdb6e209b62fea4de74c175aaa5b940fccb Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Thu, 18 Mar 2021 10:38:36 +0100
+Subject: [PATCH 2/6] add unit test for QDir::setSearchPaths
+
+---
+ autotests/kiconloader_unittest.cpp | 15 +++++++++++++++
+ autotests/resources.qrc | 1 +
+ 2 files changed, 16 insertions(+)
+
+diff --git a/autotests/kiconloader_unittest.cpp b/autotests/kiconloader_unittest.cpp
+index 9a1f6d0..813215d 100644
+--- a/autotests/kiconloader_unittest.cpp
++++ b/autotests/kiconloader_unittest.cpp
+@@ -7,6 +7,7 @@
+
+ #include <kiconloader.h>
+
++#include <QDir>
+ #include <QRegularExpression>
+ #include <QStandardPaths>
+ #include <QTest>
+@@ -495,6 +496,20 @@ private Q_SLOTS:
+ uintToHex(testColorWithAlpha.rgba(), argbHex.data());
+ QCOMPARE(argbHex, QStringLiteral("7b6496c8"));
+ }
++
++ void testQDirSetSearchPaths()
++ {
++ // setup search path for testprefix: => we shall find the iconinspecialsearchpath.svg afterwards, see e.g. bug 434451
++ QDir::setSearchPaths("testprefix", QStringList(":/searchpathdefineddir"));
++ QPixmap pix = KIconLoader::global()->loadIcon(QStringLiteral("testprefix:iconinspecialsearchpath.svg"),
++ KIconLoader::NoGroup,
++ 24,
++ KIconLoader::DefaultState,
++ QStringList(),
++ nullptr,
++ true);
++ QVERIFY(!pix.isNull());
++ }
+ };
+
+ QTEST_MAIN(KIconLoader_UnitTest)
+diff --git a/autotests/resources.qrc b/autotests/resources.qrc
+index d4000e5..4f4cd0c 100644
+--- a/autotests/resources.qrc
++++ b/autotests/resources.qrc
+@@ -10,5 +10,6 @@
+ <file>nonsquare.svg</file>
+ <file alias="/icons/themeinresource/index.theme">breeze.theme</file>
+ <file alias="/icons/themeinresource/22x22/appsNoContext/someiconintheme.png">test-22x22.png</file>
++ <file alias="/searchpathdefineddir/iconinspecialsearchpath.svg">coloredsvgicon.svg</file>
+ </qresource>
+ </RCC>
+--
+GitLab
+
+
+From 5a1690ba99d73e3e60f1a576af6b00ab29d6085f Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Thu, 18 Mar 2021 10:41:04 +0100
+Subject: [PATCH 3/6] use QDir::isAbsolutePath, not !QDir::isRelativePath
+
+---
+ src/kiconloader.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
+index 2411af1..784b06b 100644
+--- a/src/kiconloader.cpp
++++ b/src/kiconloader.cpp
+@@ -1201,8 +1201,8 @@ QString KIconLoader::iconPath(const QString &_name, int group_or_size, bool canR
+ return QString();
+ }
+
+- // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isRelativePath, see bug 434451
+- if (_name.isEmpty() || !QDir::isRelativePath(_name)) {
++ // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isAbsolutePath, see bug 434451
++ if (_name.isEmpty() || QDir::isAbsolutePath(_name)) {
+ // we have either an absolute path or nothing to work with
+ return _name;
+ }
+@@ -1340,8 +1340,8 @@ QPixmap KIconLoader::loadScaledIcon(const QString &_name,
+ name = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1Char('/') + name + QStringLiteral(".png");
+ }
+
+- // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isRelativePath, see bug 434451
+- bool absolutePath = !QDir::isRelativePath(name);
++ // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isAbsolutePath, see bug 434451
++ const bool absolutePath = QDir::isAbsolutePath(name);
+ if (!absolutePath) {
+ name = d->removeIconExtension(name);
+ }
+--
+GitLab
+
+
+From 0bd39a510b103450dac69795e6ffbc4efc074734 Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Thu, 18 Mar 2021 17:23:46 +0100
+Subject: [PATCH 4/6] more robust handling of missing global KDE themes
+
+in may cases the loader will handle absolute file names
+
+=> no need for our themes
+
+just remove the two locations where we still just exit
+in all other cases we did already proceed before
+---
+ src/kiconloader.cpp | 25 +++++++++----------------
+ 1 file changed, 9 insertions(+), 16 deletions(-)
+
+diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
+index 784b06b..6257846 100644
+--- a/src/kiconloader.cpp
++++ b/src/kiconloader.cpp
+@@ -225,7 +225,7 @@ public:
+ /**
+ * @internal
+ */
+- bool initIconThemes();
++ void initIconThemes();
+
+ /**
+ * @internal
+@@ -627,11 +627,10 @@ void KIconLoaderPrivate::init(const QString &_appname, const QStringList &extraS
+ }
+ }
+
+-bool KIconLoaderPrivate::initIconThemes()
++void KIconLoaderPrivate::initIconThemes()
+ {
+ if (mIconThemeInited) {
+- // If mpThemeRoot isn't 0 then initing has succeeded
+- return (mpThemeRoot != nullptr);
++ return;
+ }
+ // qCDebug(KICONTHEMES);
+ mIconThemeInited = true;
+@@ -644,9 +643,9 @@ bool KIconLoaderPrivate::initIconThemes()
+ qCDebug(KICONTHEMES) << "Couldn't find current icon theme, falling back to default.";
+ def = new KIconTheme(KIconTheme::defaultThemeName(), appname);
+ if (!def->isValid()) {
+- qWarning() << "Error: standard icon theme" << KIconTheme::defaultThemeName() << "not found!";
++ qCDebug(KICONTHEMES) << "Standard icon theme" << KIconTheme::defaultThemeName() << "not found!";
+ delete def;
+- return false;
++ return;
+ }
+ }
+ mpThemeRoot = new KIconThemeNode(def);
+@@ -661,8 +660,6 @@ bool KIconLoaderPrivate::initIconThemes()
+ searchPaths.append(QStringLiteral("icons")); // was xdgdata-icon in KStandardDirs
+ // These are not in the icon spec, but e.g. GNOME puts some icons there anyway.
+ searchPaths.append(QStringLiteral("pixmaps")); // was xdgdata-pixmaps in KStandardDirs
+-
+- return true;
+ }
+
+ KIconLoader::~KIconLoader() = default;
+@@ -932,7 +929,7 @@ QImage KIconLoaderPrivate::createIconImage(const QString &path, const QSize &siz
+ QImageReader reader;
+ QBuffer buffer;
+
+- if (q->theme()->followsColorScheme() && (path.endsWith(QLatin1String("svg")) || path.endsWith(QLatin1String("svgz")))) {
++ if (q->theme() && q->theme()->followsColorScheme() && (path.endsWith(QLatin1String("svg")) || path.endsWith(QLatin1String("svgz")))) {
+ buffer.setData(processSvg(path, state));
+ reader.setDevice(&buffer);
+ } else {
+@@ -1197,16 +1194,14 @@ QString KIconLoader::iconPath(const QString &_name, int group_or_size, bool canR
+
+ QString KIconLoader::iconPath(const QString &_name, int group_or_size, bool canReturnNull, qreal scale) const
+ {
+- if (!d->initIconThemes()) {
+- return QString();
+- }
+-
+ // we need to honor resource :/ paths and QDir::searchPaths => use QDir::isAbsolutePath, see bug 434451
+ if (_name.isEmpty() || QDir::isAbsolutePath(_name)) {
+ // we have either an absolute path or nothing to work with
+ return _name;
+ }
+
++ d->initIconThemes();
++
+ QString name = d->removeIconExtension(_name);
+
+ QString path;
+@@ -1381,9 +1376,7 @@ QPixmap KIconLoader::loadScaledIcon(const QString &_name,
+ }
+
+ // Image is not cached... go find it and apply effects.
+- if (!d->initIconThemes()) {
+- return QPixmap();
+- }
++ d->initIconThemes();
+
+ favIconOverlay = favIconOverlay && std::min(size.height(), size.width()) > 22;
+
+--
+GitLab
+
+
+From dd6fad78caaa0d1791bcc4a6675940cf4daf9f86 Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Thu, 18 Mar 2021 20:59:47 +0100
+Subject: [PATCH 5/6] assert hicolor default is always found
+
+we bundle a default .theme file inside the library
+resources
+
+this can't fail as fallback
+
+instead of allowing some "bad" state, just assert
+this
+---
+ src/kiconloader.cpp | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
+index 6257846..3a6bf2b 100644
+--- a/src/kiconloader.cpp
++++ b/src/kiconloader.cpp
+@@ -641,12 +641,10 @@ void KIconLoaderPrivate::initIconThemes()
+ delete def;
+ // warn, as this is actually a small penalty hit
+ qCDebug(KICONTHEMES) << "Couldn't find current icon theme, falling back to default.";
++
++ // this can't fail, as defaultThemeName() == hicolor is in a resource of this library itself as last fallback!
+ def = new KIconTheme(KIconTheme::defaultThemeName(), appname);
+- if (!def->isValid()) {
+- qCDebug(KICONTHEMES) << "Standard icon theme" << KIconTheme::defaultThemeName() << "not found!";
+- delete def;
+- return;
+- }
++ Q_ASSERT(def->isValid());
+ }
+ mpThemeRoot = new KIconThemeNode(def);
+ mThemesInTree.append(def->internalName());
+--
+GitLab
+
+
+From 3262669e3abfa7171463e3bf34f7c60eacf6bc77 Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann@kde.org>
+Date: Fri, 19 Mar 2021 19:56:07 +0100
+Subject: [PATCH 6/6] don't register our engine per default
+
+---
+ src/kiconengineplugin.json | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/kiconengineplugin.json b/src/kiconengineplugin.json
+index a5b4228..bc09e41 100644
+--- a/src/kiconengineplugin.json
++++ b/src/kiconengineplugin.json
+@@ -1,4 +1,4 @@
+ {
+- "Keys": [ "KIconEngine", "svg", "svgz", "svg.gz" ]
++ "Keys": [ "KIconEngine" ]
+ }
+
+--
+GitLab
+
diff --git a/srcpkgs/kiconthemes/template b/srcpkgs/kiconthemes/template
index ddc40a6ba1eb..30c808a58402 100644
--- a/srcpkgs/kiconthemes/template
+++ b/srcpkgs/kiconthemes/template
@@ -1,7 +1,7 @@
# Template file for 'kiconthemes'
pkgname=kiconthemes
version=5.80.0
-revision=1
+revision=2
build_style=cmake
configure_args="-DBUILD_TESTING=OFF"
hostmakedepends="kcoreaddons extra-cmake-modules kcoreaddons qt5-qmake qt5-host-tools
@@ -13,6 +13,7 @@ license="LGPL-2.0-only, GPL-2.0-or-later"
homepage="https://invent.kde.org/frameworks/kiconthemes"
distfiles="${KDE_SITE}/frameworks/${version%.*}/${pkgname}-${version}.tar.xz"
checksum=92f2dc363fb8e6b7acdf1d7013d5b06f1f825466d8db00f79cd73cfc3ed9768c
+patch_args="-Np1"
kiconthemes-devel_package() {
short_desc+=" - development"
next prev parent reply other threads:[~2021-04-06 11:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 11:58 [PR PATCH] " tunefish777
2021-04-02 15:41 ` ericonr
2021-04-02 22:35 ` Johnnynator
2021-04-06 11:26 ` [PR PATCH] [Updated] " tunefish777
2021-04-06 11:35 ` tunefish777 [this message]
2021-04-06 11:37 ` tunefish777
2021-04-06 11:44 ` tunefish777
2022-05-16 2:08 ` github-actions
2022-05-30 2:15 ` [PR PATCH] [Closed]: " github-actions
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210406113528.LgatInKtaeN_BN5iAqbHeyNPEbfxrZi7E6pSxuP2OfQ@z \
--to=tunefish777@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).