From owner-svn-ports-all@FreeBSD.ORG Thu Jan 2 16:15:32 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F3DFDE06; Thu, 2 Jan 2014 16:15:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DED351799; Thu, 2 Jan 2014 16:15:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s02GFV4H072893; Thu, 2 Jan 2014 16:15:31 GMT (envelope-from olivierd@svn.freebsd.org) Received: (from olivierd@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02GFVWI072892; Thu, 2 Jan 2014 16:15:31 GMT (envelope-from olivierd@svn.freebsd.org) Message-Id: <201401021615.s02GFVWI072892@svn.freebsd.org> From: Olivier Duchateau Date: Thu, 2 Jan 2014 16:15:31 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r338453 - head/x11-wm/xfce4-desktop/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 16:15:32 -0000 Author: olivierd Date: Thu Jan 2 16:15:31 2014 New Revision: 338453 URL: http://svnweb.freebsd.org/changeset/ports/338453 Log: Backport patch (available in xfdesktop 4.11.2), and replaces previous fix (r314575), which scales down oversize icons in menu. Obtained from: Upstream git repository Modified: head/x11-wm/xfce4-desktop/files/patch-src__xfdesktop-app-menu-item.c Modified: head/x11-wm/xfce4-desktop/files/patch-src__xfdesktop-app-menu-item.c ============================================================================== --- head/x11-wm/xfce4-desktop/files/patch-src__xfdesktop-app-menu-item.c Thu Jan 2 16:10:28 2014 (r338452) +++ head/x11-wm/xfce4-desktop/files/patch-src__xfdesktop-app-menu-item.c Thu Jan 2 16:15:31 2014 (r338453) @@ -1,78 +1,22 @@ ---- ./src/xfdesktop-app-menu-item.c.orig 2013-03-02 16:40:19.000000000 +0000 -+++ ./src/xfdesktop-app-menu-item.c 2013-03-18 09:50:38.000000000 +0000 -@@ -28,6 +28,10 @@ - #include - #endif - -+#ifdef HAVE_MATH_H -+#include -+#endif -+ - #include +--- ./src/xfdesktop-app-menu-item.c.orig 2013-09-16 07:17:42.000000000 +0000 ++++ ./src/xfdesktop-app-menu-item.c 2013-12-17 20:23:34.000000000 +0000 +@@ -31,6 +31,7 @@ #include -@@ -169,8 +173,11 @@ - xfdesktop_app_menu_item_set_icon(XfdesktopAppMenuItem *app_menu_item) - { - const gchar *icon_name; -- gint w, h, size; -+ gint w, h, size, new_size; -+ gint src_w, src_h; -+ gdouble wratio, hratio; - GdkPixbuf *pixbuf = NULL; -+ GdkPixbuf *dest; - GtkWidget *image = NULL; - GtkIconTheme *icon_theme; - gchar *p, *name = NULL; -@@ -187,7 +194,7 @@ - image = gtk_image_new_from_icon_name(icon_name, GTK_ICON_SIZE_MENU); - else { - if (g_path_is_absolute(icon_name)) { -- pixbuf = gdk_pixbuf_new_from_file_at_scale(icon_name, w, h, TRUE, NULL); -+ pixbuf = gdk_pixbuf_new_from_file(icon_name, NULL); - } else { - /* try to lookup names like application.png in the theme */ - p = strrchr(icon_name, '.'); -@@ -206,11 +213,41 @@ - } + #include ++#include - if(name) { -- pixbuf = gdk_pixbuf_new_from_file_at_scale(name, w, h, TRUE, NULL); -+ pixbuf = gdk_pixbuf_new_from_file(name, NULL); - g_free(name); - } - } + #include "xfdesktop-app-menu-item.h" + +@@ -212,6 +213,11 @@ -+ /* scale the pixbuf */ -+ if(G_LIKELY(pixbuf)) { -+ /* 24x24 pixels looks good */ -+ new_size = MIN(24, 24); -+ -+ src_w = gdk_pixbuf_get_width(pixbuf); -+ src_h = gdk_pixbuf_get_height(pixbuf); -+ -+ if(src_w > 24 || src_h > 24) { -+ /* calculate the new dimensions */ -+ wratio = (gdouble) src_w / (gdouble) new_size; -+ hratio = (gdouble) src_h / (gdouble) new_size; -+ -+ if(hratio == wratio) { -+ w = rint(src_w / hratio); -+ h = rint(src_h / hratio); -+ } -+ else if(hratio > wratio) -+ w = rint(src_w / hratio); -+ else -+ h = rint(src_h / wratio); -+ -+ dest = gdk_pixbuf_scale_simple(pixbuf, -+ MAX(w, 1), MAX(h, 1), GDK_INTERP_BILINEAR); -+ -+ g_object_unref(G_OBJECT(pixbuf)); -+ pixbuf = dest; -+ } -+ } -+ /* Turn the pixbuf into a gtk_image */ if(G_LIKELY(pixbuf)) { ++ /* scale the pixbuf down if it needs it */ ++ GdkPixbuf *tmp = exo_gdk_pixbuf_scale_down(pixbuf, TRUE, w, h); ++ g_object_unref(pixbuf); ++ pixbuf = tmp; ++ image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(G_OBJECT(pixbuf)); + }