Bug#859628: unblock: kiconthemes/5.28.0-2
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Dear release team,
I've backported two upstream changes in kiconthemes for stretch that I consider
worthwhile, as they improve the user experience, the patches are:
Inform QIconLoader also when the desktop icon theme is changed (39e3815)
KDE#365363
-> this forces qt to update the cached icons when changing the icon theme
KIconEngine: Center icon in requested rect (456b57d)
-> This matches icon positioning of the pure qt apps
And uploaded 5.28.0-2 with these patches.
I'm attaching the corresponding debdiff, the version 5.28.0-2 is already in
sid, and built in all the release architectures.
Happy hacking,
Please unblock package kiconthemes
unblock kiconthemes/5.28.0-2
-- System Information:
Debian Release: 9.0
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'testing'), (500, 'stable'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf
Kernel: Linux 4.9.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
diff -Nru kiconthemes-5.28.0/debian/changelog kiconthemes-5.28.0/debian/changelog
--- kiconthemes-5.28.0/debian/changelog 2016-11-18 16:05:18.000000000 +0100
+++ kiconthemes-5.28.0/debian/changelog 2017-04-03 12:47:09.000000000 +0200
@@ -1,3 +1,11 @@
+kiconthemes (5.28.0-2) unstable; urgency=medium
+
+ * Add new upstream patch:
+ Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch
+ * Add new upstream patch: KIconEngine-Center-icon-in-requested-rect.patch
+
+ -- Maximiliano Curia <maxy@debian.org> Mon, 03 Apr 2017 12:47:09 +0200
+
kiconthemes (5.28.0-1) unstable; urgency=medium
[ Automatic packaging ]
diff -Nru kiconthemes-5.28.0/debian/patches/Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch kiconthemes-5.28.0/debian/patches/Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch
--- kiconthemes-5.28.0/debian/patches/Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch 1970-01-01 01:00:00.000000000 +0100
+++ kiconthemes-5.28.0/debian/patches/Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch 2017-04-03 12:47:09.000000000 +0200
@@ -0,0 +1,48 @@
+From: Michael Pyne <mpyne@kde.org>
+Date: Tue, 20 Dec 2016 19:57:18 -0500
+Subject: Inform QIconLoader also when the desktop icon theme is changed.
+
+This change is needed because KIconTheme will defer to QIconLoader's
+concept of the current icon theme in preference to our own global
+config, if that current icon theme is set.
+
+Qt normally leaves it unset but once it starts loading icons through our
+platform plugin, it will remember which theme was in use.
+
+This means when we change the configured icon theme, that we would
+sometimes accidentally continue to load icons from the old icon theme
+(the one remembered by Qt).
+
+Thanks to Wolfgang Bauer for debugging the issue, narrowing the
+potential causes of the bug was instrumental in fixing it!
+
+BUG:365363
+FIXED-IN:5.30
+---
+ src/kiconloader.cpp | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp
+index 5315ea4..726b43f 100644
+--- a/src/kiconloader.cpp
++++ b/src/kiconloader.cpp
+@@ -541,7 +541,18 @@ void KIconLoaderPrivate::drawOverlays(const KIconLoader *iconLoader, KIconLoader
+
+ void KIconLoaderPrivate::_k_refreshIcons(int group)
+ {
+- KSharedConfig::openConfig()->reparseConfiguration();
++ KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig();
++ sharedConfig->reparseConfiguration();
++
++ const QString newThemeName = sharedConfig->group("Icons")
++ .readEntry("Theme", QString());
++ if (!newThemeName.isEmpty()) {
++ // If we're refreshing icons the Qt platform plugin has probably
++ // already cached the old theme, which will accidentally filter back
++ // into KIconTheme unless we reset it
++ QIcon::setThemeName(newThemeName);
++ }
++
+ q->newIconLoader();
+ mIconAvailability.clear();
+ emit q->iconChanged(group);
diff -Nru kiconthemes-5.28.0/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch kiconthemes-5.28.0/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch
--- kiconthemes-5.28.0/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch 1970-01-01 01:00:00.000000000 +0100
+++ kiconthemes-5.28.0/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch 2017-04-03 12:47:09.000000000 +0200
@@ -0,0 +1,71 @@
+From: David Rosca <nowrep@gmail.com>
+Date: Sun, 22 Jan 2017 17:36:03 +0100
+Subject: KIconEngine: Center icon in requested rect
+
+Match the behavior of Qt's internal icon engines.
+
+Differential Revision: https://phabricator.kde.org/D4247
+---
+ autotests/kiconengine_unittest.cpp | 15 +++++++++++++++
+ src/kiconengine.cpp | 10 ++--------
+ 2 files changed, 17 insertions(+), 8 deletions(-)
+
+diff --git a/autotests/kiconengine_unittest.cpp b/autotests/kiconengine_unittest.cpp
+index ac26b8d..60476df 100644
+--- a/autotests/kiconengine_unittest.cpp
++++ b/autotests/kiconengine_unittest.cpp
+@@ -127,6 +127,21 @@ private Q_SLOTS:
+ QCOMPARE(icon3.name(), nonExistingIconName);
+
+ }
++
++ void testCenterIcon()
++ {
++ QIcon icon(new KIconEngine(QStringLiteral("kde"), KIconLoader::global()));
++ QVERIFY(!icon.isNull());
++
++ // "kde" icon is actually "test-22x22.png", so this is original icon image
++ const QImage image = icon.pixmap(22, 22).toImage();
++
++ // center vertically
++ QVERIFY(icon.pixmap(22, 26).toImage().copy(0, 2, 22, 22) == image);
++
++ // center horizontally
++ QVERIFY(icon.pixmap(26, 22).toImage().copy(2, 0, 22, 22) == image);
++ }
+ private:
+ QDir testIconsDir;
+ };
+diff --git a/src/kiconengine.cpp b/src/kiconengine.cpp
+index 6f3288c..da6051e 100644
+--- a/src/kiconengine.cpp
++++ b/src/kiconengine.cpp
+@@ -72,18 +72,12 @@ void KIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode,
+ return;
+ }
+
+- Q_UNUSED(state)
+-
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ const qreal dpr = painter->device()->devicePixelRatioF();
+ #else
+ const qreal dpr = painter->device()->devicePixelRatio();
+ #endif
+-
+- const int kstate = qIconModeToKIconState(mode);
+- const int iconSize = qMin(rect.width(), rect.height()) * dpr;
+- const QPixmap pix = mIconLoader.data()->loadIcon(mIconName, KIconLoader::Desktop, iconSize, kstate, mOverlays);
+- painter->drawPixmap(rect, pix);
++ painter->drawPixmap(rect, pixmap(rect.size() * dpr, mode, state));
+ }
+
+ QPixmap KIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
+@@ -113,7 +107,7 @@ QPixmap KIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
+ pix2.fill(QColor(0, 0, 0, 0));
+
+ QPainter painter(&pix2);
+- painter.drawPixmap(QPoint(), pix);
++ painter.drawPixmap(QPoint((pix2.width() - pix.width()) / 2, (pix2.height() - pix.height()) / 2), pix);
+
+ return pix2;
+ }
diff -Nru kiconthemes-5.28.0/debian/patches/series kiconthemes-5.28.0/debian/patches/series
--- kiconthemes-5.28.0/debian/patches/series 1970-01-01 01:00:00.000000000 +0100
+++ kiconthemes-5.28.0/debian/patches/series 2017-04-03 12:47:09.000000000 +0200
@@ -0,0 +1,2 @@
+Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch
+KIconEngine-Center-icon-in-requested-rect.patch
Reply to: