- /* Turn the pixbuf into a gtk_image */
- if (G_LIKELY (pixbuf))
- {
- /* scale the pixbuf down if it needs it */
- GdkPixbuf *tmp = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);
- 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_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);
+ g_object_unref (G_OBJECT (pixbuf));
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;
}