[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Wishlist: Patches to enable selection of panel icon size in KDE 4.4



Hi folks, 

There is an unfortunate departure in behavior in KDE 4.4 where panel icons
are constrained to a much smaller size as compared to previous KDE 4
releases.

Prior to KDE 4.4, panel icons would size to the height of the panel (for
horizontal panels, width for vertical) until the icons reached size 48x48.
In KDE 4.4 this "size cap" has been reduced to 32x32, resulting in much
smaller icons for folks who use large panels.

This is a well known problem, having been complained about on KDE community
forms [1, 2, 3, 4] and in bug reports [5, 6, 7].  It turns out that this
"bug" is actually an intended change, as folks who use vertical panels on
widescreens prefer smaller icon sizes [8].

Really, the underlying problem is that (the maximum) panel icon size is
not-yet configurable in KDE 4.4, and instead an arbitrary, hard coded
maximum is used.  Particularly embarassing is the fact that the KDE 4
Appearance dialog (System Settings) has always had the option to set the
panel icon size--but that size is ignored by the current widget
implementations and in recent versions the selection field has been
disabled.

Recently I've been working on the KDE plasma-devel mailing list to have a
set of patches committed for KDE 4.5 that would restore setting of the
panel icon size and implement the necesary routines in panel widgets to
respect this size [9].  When this was tested and done, I backported and tested
the necessary changes to the KDE 4.4 branch with the hope of having them
included in 4.4.5, and thus Debian squeeze [10].

Unfortunately, while the patches themselves have been green lighted for
inclusion in KDE 4.4.5, the Plasma developers are too busy getting KDE 4.5
out to actually commit the changes to the 4.4 branch [11].  And I don't have
commit rights on the subversion repo myself.

Long story short, I'd really like to see these fixes implemented in
Debian's KDE for squeeze.  The inability to set the panel icon size is, in
my mind, a long-standing bug.  Furthermore, it is an accessibility issue,
as folks with poorer vision who prefer large panels no longer have
full-size icons.  Also, users coming from KDE 3.5 also expect the ability
to set the panel icon size as panel icon sizing is an option that has
historically been available in a working state.

Attached are a set of patches against Debian KDE 4.4.4-1 to implement the
appropriate panel icon sizing behavior.  It is essentially the same as the
4.4.5 branch backport that I originally posted [10].  Normally I would just
file a wishlist bug with the patches attach and "see what happens", but the
patches themselves apply against four different source packages (kde4libs,
kdebase-runtime, kdebase-workspace, kdeplasma-addons)--so I'm not quite
sure how to coordinate that.

The first patch (against kdebase-runtime) restores the ability to set the
panel icon size in the System Settings -> Appearance dialog.  The default
size is 32, which is the current hardcoded size in KDE 4.4.  So there is no
observable change to the user until a new size is set.

The next three patches (kde4libs, kdebase-workspace, kdeplasma-addons) add
two methods to "icon-like" panel widgets (kickoff menu, the "simple"
launcher menu, application-shortcut icons, and lancelot) to respond to
panel icon size changes.

I should note that the patches are _not_ interdependent.  They can be
applied to their source packages in isolation with no ill effect.  However,
the usefulness of the patches are limited until they're all applied.

Thoughts?  Do any of the Debian KDE packagers have commit rights to the
upstream subversion repo?  That might be the path of least resistance.
Otherwise, might we be able to include these patches in the Debian
packaging?

Also, for full disclosure: there is an outstanding bug in that, when panel
icons are set to a size less than 48, they still scale with the panel until
the icon reaches size 48x48, at which point they reduce back to the
configured size (e.g., 32x32).  This is an unrelated bug that is currently
present in Debian KDE 4.4.4-1 and, to my knowledge, still is in KDE trunk.
Thought it worth mentioning since it's referenced in some of the linked bug
reports.

Thanks!

Icon size complaints on KDE Community Forms:
[1] http://forum.kde.org/viewtopic.php?f=67&t=85470
[2] http://forum.kde.org/viewtopic.php?f=15&t=85787
[3] http://forum.kde.org/viewtopic.php?f=67&t=86555 (a Debian user)
[4] http://forum.kde.org/viewtopic.php?f=66&t=88265

Icon size bug reports:
[5] https://bugs.kde.org/show_bug.cgi?id=226039
[6] https://bugs.kde.org/show_bug.cgi?id=201619
[7] https://bugs.kde.org/show_bug.cgi?id=193756

Original bug that resulted in the KDE 4.4 change:
[8] https://bugs.kde.org/show_bug.cgi?id=168579

Plasma-devel mailing list discussion:
[9]  http://mail.kde.org/pipermail/plasma-devel/2010-May/011829.html
[10] http://mail.kde.org/pipermail/plasma-devel/2010-June/011975.html
[11] http://mail.kde.org/pipermail/plasma-devel/2010-June/012044.html
# HG changeset patch
# Parent 37519dabdfb92238b874bffa44bd383312f27a01

diff --git a/kcontrol/icons/icons.cpp b/kcontrol/icons/icons.cpp
--- a/kcontrol/icons/icons.cpp
+++ b/kcontrol/icons/icons.cpp
@@ -409,10 +409,10 @@
         return;
 
     mUsage = index;
-    if ( mUsage == KIconLoader::Panel || mUsage == KIconLoader::LastGroup )
+    if ( mUsage == KIconLoader::LastGroup )
     {
         mpSizeBox->setEnabled(false);
-	mpAnimatedCheck->setEnabled( mUsage == KIconLoader::Panel );
+        mpAnimatedCheck->setEnabled(false);
     }
     else
     {
# HG changeset patch
# Parent 3afb7749757efcce7d6a94bd15f61b11a02ef73b
diff --git a/plasma/popupapplet.cpp b/plasma/popupapplet.cpp
--- a/plasma/popupapplet.cpp
+++ b/plasma/popupapplet.cpp
@@ -408,6 +408,27 @@
     emit q->sizeHintChanged(Qt::PreferredSize);
 }
 
+QSizeF PopupApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
+{
+    if (!d->dialogPtr || which != Qt::PreferredSize) {
+        return Applet::sizeHint(which, constraint);
+    }
+
+    switch (formFactor()) {
+        case Vertical:
+        case Horizontal: {
+            const int size = IconSize(KIconLoader::Panel);
+            return QSizeF(size, size);
+            break;
+        }
+        default:
+            break;
+    }
+
+    const int size = IconSize(KIconLoader::Desktop);
+    return QSizeF(size, size);
+}
+
 void PopupApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     if (!d->icon && !d->popupLostFocus && event->buttons() == Qt::LeftButton) {
@@ -580,6 +601,7 @@
           popupLostFocus(false),
           passive(false)
 {
+    QObject::connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), q, SLOT(iconSizeChanged(int)));
 }
 
 PopupAppletPrivate::~PopupAppletPrivate()
@@ -592,6 +614,13 @@
     delete icon;
 }
 
+void PopupAppletPrivate::iconSizeChanged(int group)
+{
+    if (icon && (group == KIconLoader::Desktop || group == KIconLoader::Panel)) {
+        q->updateGeometry();
+    }
+}
+
 void PopupAppletPrivate::internalTogglePopup()
 {
     if (timer) {
diff --git a/plasma/popupapplet.h b/plasma/popupapplet.h
--- a/plasma/popupapplet.h
+++ b/plasma/popupapplet.h
@@ -144,6 +144,7 @@
      */
     virtual void popupEvent(bool show);
 
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
     void mousePressEvent(QGraphicsSceneMouseEvent *event);
     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
     bool eventFilter(QObject *watched, QEvent *event);
@@ -168,6 +169,7 @@
     Q_PRIVATE_SLOT(d, void dialogSizeChanged())
     Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool))
     Q_PRIVATE_SLOT(d, void updateDialogPosition())
+    Q_PRIVATE_SLOT(d, void iconSizeChanged(int))
 
     friend class Applet;
     friend class AppletPrivate;
diff --git a/plasma/private/popupapplet_p.h b/plasma/private/popupapplet_p.h
--- a/plasma/private/popupapplet_p.h
+++ b/plasma/private/popupapplet_p.h
@@ -33,6 +33,7 @@
     PopupAppletPrivate(PopupApplet *applet);
     ~PopupAppletPrivate();
 
+    void iconSizeChanged(int group);
     void internalTogglePopup();
     void hideTimedPopup();
     void clearPopupLostFocus();
# HG changeset patch
# Parent 0c4c715c75094fca84b15e28146bb1c70931c88a
diff --git a/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp b/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
--- a/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
+++ b/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.cpp
@@ -371,6 +371,9 @@
     }
 
     constraintsEvent(Plasma::ImmutableConstraint);
+
+    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
+        this, SLOT(iconSizeChanged(int)));
 }
 
 void MenuLauncherApplet::constraintsEvent(Plasma::Constraints constraints)
@@ -787,4 +790,35 @@
     return d->actions;
 }
 
+void MenuLauncherApplet::iconSizeChanged(int group)
+{
+    if (group == KIconLoader::Desktop || group == KIconLoader::Panel) {
+        updateGeometry();
+    }
+}
+
+QSizeF MenuLauncherApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
+{
+    if (which == Qt::PreferredSize) {
+        int iconSize;
+
+        switch (formFactor()) {
+            case Plasma::Planar:
+            case Plasma::MediaCenter:
+                iconSize = IconSize(KIconLoader::Desktop);
+                break;
+
+            case Plasma::Horizontal:
+            case Plasma::Vertical:
+                iconSize = IconSize(KIconLoader::Panel);
+                break;
+        }
+
+        return QSizeF(iconSize, iconSize);
+    }
+
+    return Plasma::Applet::sizeHint(which, constraint);
+}
+
+
 #include "simpleapplet.moc"
diff --git a/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h b/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
--- a/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
+++ b/plasma/desktop/applets/kickoff/simpleapplet/simpleapplet.h
@@ -126,6 +126,8 @@
      */
     void createConfigurationInterface(KConfigDialog *parent);
 
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
+
 private Q_SLOTS:
 	/// Configuration-dialog accepted.
     void configAccepted();
@@ -133,6 +135,8 @@
     void toggleMenu(bool pressed = true);
     /// An action within the menu got triggered.
     void actionTriggered(QAction *action);
+    /// Icon size setting changed
+    void iconSizeChanged(int group);
 
 private:
     class Private;
diff --git a/plasma/generic/applets/icon/icon.cpp b/plasma/generic/applets/icon/icon.cpp
--- a/plasma/generic/applets/icon/icon.cpp
+++ b/plasma/generic/applets/icon/icon.cpp
@@ -27,6 +27,7 @@
 
 #include <KDebug>
 #include <KDesktopFile>
+#include <KGlobalSettings>
 #include <KIconLoader>
 #include <KLocale>
 #include <KMenu>
@@ -84,6 +85,9 @@
     setDisplayLines(2);
     registerAsDragHandle(m_icon);
     setAspectRatioMode(Plasma::ConstrainedSquare);
+
+    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
+        this, SLOT(iconSizeChanged(int)));
 }
 
 IconApplet::~IconApplet()
@@ -110,6 +114,13 @@
     }
 }
 
+void IconApplet::iconSizeChanged(int group)
+{
+    if (group == KIconLoader::Desktop || group == KIconLoader::Panel) {
+        updateGeometry();
+    }
+}
+
 void IconApplet::setUrl(const KUrl& url)
 {
     m_url = KIO::NetAccess::mostLocalUrl(url, 0);
@@ -252,6 +263,29 @@
     }
 }
 
+QSizeF IconApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
+{
+    if (which == Qt::PreferredSize) {
+        int iconSize;
+
+        switch (formFactor()) {
+            case Plasma::Planar:
+            case Plasma::MediaCenter:
+                iconSize = IconSize(KIconLoader::Desktop);
+                break;
+
+            case Plasma::Horizontal:
+            case Plasma::Vertical:
+                iconSize = IconSize(KIconLoader::Panel);
+                break;
+        }
+
+        return QSizeF(iconSize, iconSize);
+    }
+
+    return Plasma::Applet::sizeHint(which, constraint);
+}
+
 void IconApplet::setDisplayLines(int displayLines)
 {
     if (m_icon) {
diff --git a/plasma/generic/applets/icon/icon.h b/plasma/generic/applets/icon/icon.h
--- a/plasma/generic/applets/icon/icon.h
+++ b/plasma/generic/applets/icon/icon.h
@@ -56,12 +56,14 @@
         void dropEvent(QGraphicsSceneDragDropEvent *event);
         void saveState(KConfigGroup &cg) const;
         void showConfigurationInterface();
+        QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
 
     private slots:
         void acceptedPropertiesDialog();
         void propertiesDialogClosed();
         void delayedDestroy();
         void checkExistenceOfUrl();
+        void iconSizeChanged(int group);
 
     private:
         //dropUrls from DolphinDropController
# HG changeset patch
# Parent 6d2c471ae7166f435f3d1e857f5531e295957b4c

diff --git a/applets/lancelot/app/src/launcher/LancelotApplet.cpp b/applets/lancelot/app/src/launcher/LancelotApplet.cpp
--- a/applets/lancelot/app/src/launcher/LancelotApplet.cpp
+++ b/applets/lancelot/app/src/launcher/LancelotApplet.cpp
@@ -19,6 +19,7 @@
 
 #include "LancelotApplet.h"
 #include <KIcon>
+#include <KGlobalSettings>
 #include <climits>
 
 #include <QDBusInterface>
@@ -179,6 +180,9 @@
 
     d->waitClick.setInterval(500); // 1/2 sec
     d->waitClick.setSingleShot(true);
+
+    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
+        this, SLOT(iconSizeChanged(int)));
 }
 
 // void LancelotApplet::paint(QPainter * p,
@@ -217,16 +221,46 @@
 {
     d->layout->setContentsMargins(0, 0, 0, 0);
     d->layout->setSpacing(SPACING);
+
     if (d->showCategories) {
         d->createCategoriesButtons();
     } else {
         d->createMainButton();
     }
+
+    // We want to update the size hints
+    iconSizeChanged(KIconLoader::Desktop);
+
     emit configNeedsSaving();
     update();
     setAspectRatioMode(Plasma::KeepAspectRatio);
 }
 
+void LancelotApplet::iconSizeChanged(int group)
+{
+    if (group == KIconLoader::Desktop || group == KIconLoader::Panel) {
+        int iconSize;
+
+        switch (formFactor()) {
+            case Plasma::Planar:
+            case Plasma::MediaCenter:
+                iconSize = IconSize(KIconLoader::Desktop);
+                break;
+
+            case Plasma::Horizontal:
+            case Plasma::Vertical:
+                iconSize = IconSize(KIconLoader::Panel);
+                break;
+        }
+
+        foreach (Lancelot::HoverIcon * icon, d->buttons) {
+            icon->setPreferredSize(QSizeF(iconSize, iconSize));
+        }
+
+        updateGeometry();
+    }
+}
+
 void LancelotApplet::init()
 {
     d->lancelot->addClient();
diff --git a/applets/lancelot/app/src/launcher/LancelotApplet.h b/applets/lancelot/app/src/launcher/LancelotApplet.h
--- a/applets/lancelot/app/src/launcher/LancelotApplet.h
+++ b/applets/lancelot/app/src/launcher/LancelotApplet.h
@@ -58,6 +58,7 @@
     void applyConfig();
     void loadConfig();
     void saveConfig();
+    void iconSizeChanged(int group);
 
 private:
     class Private;

Reply to: