mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
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).
This commit is contained in:
committed by
Carlos R. Mafra
parent
2e7b7b7e02
commit
af41673dbf
@@ -27,6 +27,7 @@
|
|||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "framewin.h"
|
#include "framewin.h"
|
||||||
|
#include "icon.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
#include "switchpanel.h"
|
#include "switchpanel.h"
|
||||||
@@ -148,18 +149,6 @@ static void changeImage(WSwitchPanel *panel, int idecks, int selected)
|
|||||||
WMSetFrameRelief(icon, WRSimple);
|
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)
|
static void addIconForWindow(WSwitchPanel *panel, WMWidget *parent, WWindow *wwin, int x, int y)
|
||||||
{
|
{
|
||||||
WMFrame *icon = WMCreateFrame(parent);
|
WMFrame *icon = WMCreateFrame(parent);
|
||||||
@@ -176,7 +165,8 @@ static void addIconForWindow(WSwitchPanel *panel, WMWidget *parent, WWindow *wwi
|
|||||||
if (!image)
|
if (!image)
|
||||||
image = wDefaultGetImage(panel->scr, wwin->wm_instance, wwin->wm_class, ICON_TILE_SIZE);
|
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->images, image);
|
||||||
WMAddToArray(panel->icons, icon);
|
WMAddToArray(panel->icons, icon);
|
||||||
|
|||||||
Reference in New Issue
Block a user