Menu icons don't all have the same size
Bug #1806256 reported by
Pierre Rudloff
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Garcon |
Fix Released
|
Medium
|
|||
garcon (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
New
|
Undecided
|
Unassigned | ||
Cosmic |
New
|
Undecided
|
Unassigned | ||
Disco |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Hello,
Since I upgraded to cosmic, some icons in the Xfce menu are too big. It only happens with specific apps like lftp or xsane.
ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: xfce4-panel 4.13.3-1ubuntu1
ProcVersionSign
Uname: Linux 4.18.0-11-generic x86_64
ApportVersion: 2.20.10-0ubuntu13.1
Architecture: amd64
CurrentDesktop: XFCE
Date: Sun Dec 2 16:51:42 2018
InstallationDate: Installed on 2016-04-06 (970 days ago)
InstallationMedia: Xubuntu 16.04 LTS "Xenial Xerus" - Beta amd64 (20160323)
SourcePackage: xfce4-panel
UpgradeStatus: No upgrade log present (probably fresh install)
affects: | xfce4-panel (Ubuntu) → garcon (Ubuntu) |
Changed in garcon: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
To post a comment you must log in.
Created attachment 7268
A screenshot of the issue
Some packages only provide icons in sizes much bigger than the standard
GTK menu size of 16px.
The clipboard manager qlipper for example provides the following icon: icons/hicolor/ 128x128/ apps/qlipper. png
/usr/share/
In GTK 3.22.18 the function gtk_image_ new_from_ icon_name when given
GTK_ICON_SIZE_MENU as second argument still returns an image with 128x128.
The patch I have supplied uses existing code to scale such an image.
diff --git a/garcon- gtk/garcon- gtk-menu. c b/garcon- gtk/garcon- gtk-menu. c gtk/garcon- gtk-menu. c gtk/garcon- gtk-menu. c gtk_menu_ load_icon (const gchar *icon_name) icon_size_ lookup (GTK_ICON_ SIZE_MENU, &w, &h);
index 41990f2..f31a1ed 100644
--- a/garcon-
+++ b/garcon-
@@ -650,7 +650,11 @@ garcon_
gtk_
size = MIN (w, h);
- if (! gtk_icon_ theme_has_ icon (icon_theme, icon_name)) theme_has_ icon (icon_theme, icon_name)) theme_load_ icon (icon_theme, icon_name, size, 0, NULL);; gtk_menu_ load_icon (const gchar *icon_name)
g_free (name);
+ if (gtk_icon_
+ {
+ pixbuf = gtk_icon_
+ }
+ else
{
if (g_path_is_absolute (icon_name))
{
@@ -684,22 +688,23 @@ garcon_
}
}
+ }
- /* Turn the pixbuf into a gtk_image */ scale_simple (pixbuf, w, h, GDK_INTERP_ BILINEAR) ; scale_simple (pixbuf, w, h, GDK_INTERP_ BILINEAR) ;
- if (G_LIKELY (pixbuf))
- {
- /* scale the pixbuf down if it needs it */
- GdkPixbuf *tmp = gdk_pixbuf_
- g_object_unref (pixbuf);
- pixbuf = tmp;
+ /* Turn the pixbuf into a gtk_image */
+ if (G_LIKELY (pixbuf))
+ {
+ /* scale the pixbuf down if it needs it */
+ GdkPixbuf *pixbuf_scaled = gdk_pixbuf_
+ g_object_unref (G_OBJECT (pixbuf));
- image = gtk_image_ new_from_ pixbuf (pixbuf); new_from_ pixbuf (pixbuf_scaled); new_from_ icon_name (icon_name, GTK_ICON_ SIZE_MENU) ; new_from_ icon_name (icon_name, GTK_ICON_ SIZE_MENU) ;
- g_object_unref (G_OBJECT (pixbuf));
- }
+ image = gtk_image_
+ g_object_unref (G_OBJECT (pixbuf_scaled));
+ }
+ else
+ {
+ /* display the placeholder at least */
+ image = gtk_image_
}
-
- if (image == NULL)
- image = gtk_image_
return image;
}