From: Rodolfo García Peñas (kix) Date: Sun, 15 Jul 2012 19:28:00 +0000 (+0200) Subject: Removed scaleDownIfNeeded function (dup code) X-Git-Tag: wmaker-0.95.4~133 X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/commitdiff_plain/af41673dbf35c663ddba82f99a34b6651060b1b1 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). --- 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);