mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 22:28:02 +01:00
Better icon scale
The icons should be scaled if their size is "max_size - ~3 pixels". Tipically, max_size is 64 pixels. With the current wIconValidateIconSize the max size for an icon is "64 pixels", then the icon don't have border and is ugly. This problem is in the dock icons and in the switchpanel. The new wIconValidateIconSize function don't use the fixel value of 64 pixels, uses the argument max_size to get the final icon size. The icon is scaled holding the aspect ratio and reserve ~2 or ~3 pixels to hold left space to the icon border. Now the icon is inside the icon space, with border. This patch removes the preprocessor option of DONT_SCALE_ICONS, because all the icons should be scaled if needed, to hold a beatiful interface.
This commit is contained in:
committed by
Carlos R. Mafra
parent
44c9ee694d
commit
fccde3b7e6
19
src/icon.c
19
src/icon.c
@@ -50,6 +50,7 @@ extern WPreferences wPreferences;
|
||||
|
||||
#define MOD_MASK wPreferences.modifier_mask
|
||||
#define CACHE_ICON_PATH "/Library/WindowMaker/CachedPixmaps"
|
||||
#define ICON_BORDER 3
|
||||
|
||||
extern Cursor wCursor[WCUR_LAST];
|
||||
|
||||
@@ -337,23 +338,21 @@ void wIconChangeTitle(WIcon * icon, char *new_title)
|
||||
wIconPaint(icon);
|
||||
}
|
||||
|
||||
RImage *wIconValidateIconSize(WScreen * scr, RImage * icon, int max_size)
|
||||
RImage *wIconValidateIconSize(WScreen *scr, RImage *icon, int max_size)
|
||||
{
|
||||
RImage *tmp;
|
||||
int w, h;
|
||||
RImage *nimage;
|
||||
|
||||
if (!icon)
|
||||
return NULL;
|
||||
#ifndef DONT_SCALE_ICONS
|
||||
if (max_size != 64) {
|
||||
w = max_size * icon->width / 64;
|
||||
h = max_size * icon->height / 64;
|
||||
|
||||
tmp = RScaleImage(icon, w, h);
|
||||
/* We should hold "ICON_BORDER" (~2) pixels to include the icon border */
|
||||
if ((icon->width - max_size) > -ICON_BORDER ||
|
||||
(icon->height - max_size) > -ICON_BORDER) {
|
||||
nimage = RScaleImage(icon, max_size - ICON_BORDER,
|
||||
(icon->height * (max_size - ICON_BORDER) / icon->width));
|
||||
RReleaseImage(icon);
|
||||
icon = tmp;
|
||||
icon = nimage;
|
||||
}
|
||||
#endif
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
@@ -99,9 +99,6 @@
|
||||
*/
|
||||
#undef IGNORE_PPOSITION
|
||||
|
||||
/* Do not scale application icon and miniwindow icon images */
|
||||
#undef DONT_SCALE_ICONS
|
||||
|
||||
/*
|
||||
* The following options WILL NOT BE MADE RUN-TIME. Please do not request.
|
||||
* They will only add unneeded bloat.
|
||||
|
||||
Reference in New Issue
Block a user