From af41673dbf35c663ddba82f99a34b6651060b1b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sun, 15 Jul 2012 21:28:00 +0200 Subject: [PATCH] Removed scaleDownIfNeeded function (dup code) The function scaleDownIfNeeded's code is duplicated with the code of wIconValidateIconSize(), then this function can be removed. The icon size in the switchpanel should be ~48 pixels, to allow the frame around the icon. Then, we always should resize the icon to this size. The standard icon size is specified in WPreferences.icon_size (usually 64 pixels). --- src/switchpanel.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/switchpanel.c b/src/switchpanel.c index 7e3f2f3c..5006bce6 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -27,6 +27,7 @@ #include "WindowMaker.h" #include "screen.h" #include "framewin.h" +#include "icon.h" #include "window.h" #include "defaults.h" #include "switchpanel.h" @@ -148,18 +149,6 @@ static void changeImage(WSwitchPanel *panel, int idecks, int selected) WMSetFrameRelief(icon, WRSimple); } -static RImage *scaleDownIfNeeded(RImage *image) -{ - if (image && ((image->width - ICON_SIZE) > 2 || (image->height - ICON_SIZE) > 2)) { - RImage *nimage; - nimage = RScaleImage(image, ICON_SIZE, (image->height * ICON_SIZE / image->width)); - RReleaseImage(image); - image = nimage; - } - - return image; -} - static void addIconForWindow(WSwitchPanel *panel, WMWidget *parent, WWindow *wwin, int x, int y) { WMFrame *icon = WMCreateFrame(parent); @@ -176,7 +165,8 @@ static void addIconForWindow(WSwitchPanel *panel, WMWidget *parent, WWindow *wwi if (!image) image = wDefaultGetImage(panel->scr, wwin->wm_instance, wwin->wm_class, ICON_TILE_SIZE); - image = scaleDownIfNeeded(image); + /* We must resize the icon size (~64) to the switchpanel icon size (~48) */ + image = wIconValidateIconSize(image, ICON_SIZE); WMAddToArray(panel->images, image); WMAddToArray(panel->icons, icon); -- 2.11.4.GIT