Skip to content

Commit e310226

Browse files
committed
panel-launchers: Don't allow the size of custom icons to be reset.
When the theme changed, _updateIconSize would compare the current icon size with smallest of either its container's height or its width. Only one direction would be set (depending on panel orientation), so the smallest size was always 0, resetting the StIcon's icon_size property to 0. This would force it to look at the theme for the icon size (which would be too large for the panel).
1 parent 20864d2 commit e310226

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,22 @@ class PanelAppLauncher extends DND.LauncherDraggable {
282282

283283
_updateIconSize() {
284284
let node = this._iconBox.get_theme_node();
285-
let maxHeight = this._iconBox.height - node.get_vertical_padding();
286-
let maxWidth = this._iconBox.width - node.get_horizontal_padding();
287-
let smallestDim = Math.min(maxHeight, maxWidth) / global.ui_scale;
285+
let enforcedSize = 0;
288286

289-
if (smallestDim < this.icon.get_icon_size()) {
290-
this.icon.set_icon_size(smallestDim);
287+
if (this._iconBox.height > 0) {
288+
enforcedSize = this._iconBox.height - node.get_vertical_padding();
289+
}
290+
else
291+
if (this._iconBox.width > 0) {
292+
enforcedSize = this._iconBox.width - node.get_horizontal_padding();
293+
}
294+
else
295+
{
296+
enforcedSize = -1;
297+
}
298+
299+
if (enforcedSize < this.icon.get_icon_size()) {
300+
this.icon.set_icon_size(enforcedSize);
291301
}
292302
}
293303

src/cinnamon-app.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ get_actor_for_icon_name (CinnamonApp *app,
188188

189189
if (icon != NULL)
190190
{
191-
actor = g_object_new (ST_TYPE_ICON, "gicon", icon, "icon-size", size, NULL);
191+
actor = g_object_new (ST_TYPE_ICON, "gicon", icon, "icon-type", ST_ICON_FULLCOLOR, "icon-size", size, NULL);
192192
g_object_unref (icon);
193193
}
194194

@@ -199,7 +199,7 @@ static ClutterActor *
199199
get_failsafe_icon (int size)
200200
{
201201
GIcon *icon = g_themed_icon_new ("application-x-executable");
202-
ClutterActor *actor = g_object_new (ST_TYPE_ICON, "gicon", icon, "icon-size", size, NULL);
202+
ClutterActor *actor = g_object_new (ST_TYPE_ICON, "gicon", icon, "icon-type", ST_ICON_FULLCOLOR, "icon-size", size, NULL);
203203
g_object_unref (icon);
204204
return actor;
205205
}

0 commit comments

Comments
 (0)