mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
Don't shrink icons in switchpanel.
Icons in the switchpanel are constrained to the value of the IconSize preference but the grid in which they are arranged is fixed at 64 pixels. If IconSize is less than 64x64 the panel will show smaller icons with a wide spacing, which looks pretty stupid. Fix it by forcing the switchpanel to attempt to load images at the size it's going to use. The icon it actually gets may of course still be smaller.
This commit is contained in:
committed by
Carlos R. Mafra
parent
854ae58305
commit
07a0639c93
@@ -966,7 +966,7 @@ void wDefaultsCheckDomains(void* arg)
|
||||
/* Update the panel image if changed */
|
||||
/* Don't worry. If the image is the same these
|
||||
* functions will have no performance impact. */
|
||||
image = wDefaultGetImage(scr, "Logo", "WMPanel");
|
||||
image = wDefaultGetImage(scr, "Logo", "WMPanel", wPreferences.icon_size);
|
||||
|
||||
if (!image) {
|
||||
wwarning(_("could not load logo image for panels: %s"),
|
||||
|
||||
@@ -52,7 +52,7 @@ void wSaveDefaults(WScreen *scr);
|
||||
char *wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
|
||||
Bool noDefault);
|
||||
|
||||
RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass);
|
||||
RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_size);
|
||||
|
||||
void wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
|
||||
WWindowAttributes *attr, WWindowAttributes *mask,
|
||||
|
||||
16
src/icon.c
16
src/icon.c
@@ -154,7 +154,7 @@ WIcon *wIconCreate(WWindow * wwin)
|
||||
#else
|
||||
icon->show_title = 1;
|
||||
#endif
|
||||
icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class);
|
||||
icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
|
||||
|
||||
file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class, False);
|
||||
if (file) {
|
||||
@@ -215,7 +215,7 @@ WIcon *wIconCreateWithIconFile(WScreen * scr, char *iconfile, int tile)
|
||||
wwarning(_("error loading image file \"%s\": %s"), iconfile, RMessageForError(RErrorCode));
|
||||
}
|
||||
|
||||
icon->file_image = wIconValidateIconSize(scr, icon->file_image);
|
||||
icon->file_image = wIconValidateIconSize(scr, icon->file_image, wPreferences.icon_size);
|
||||
|
||||
icon->file = wstrdup(iconfile);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ void wIconChangeTitle(WIcon * icon, char *new_title)
|
||||
wIconPaint(icon);
|
||||
}
|
||||
|
||||
RImage *wIconValidateIconSize(WScreen * scr, RImage * icon)
|
||||
RImage *wIconValidateIconSize(WScreen * scr, RImage * icon, int max_size)
|
||||
{
|
||||
RImage *tmp;
|
||||
int w, h;
|
||||
@@ -362,9 +362,9 @@ RImage *wIconValidateIconSize(WScreen * scr, RImage * icon)
|
||||
if (!icon)
|
||||
return NULL;
|
||||
#ifndef DONT_SCALE_ICONS
|
||||
if (wPreferences.icon_size != 64) {
|
||||
w = wPreferences.icon_size * icon->width / 64;
|
||||
h = wPreferences.icon_size * icon->height / 64;
|
||||
if (max_size != 64) {
|
||||
w = max_size * icon->width / 64;
|
||||
h = max_size * icon->height / 64;
|
||||
|
||||
tmp = RScaleImage(icon, w, h);
|
||||
RReleaseImage(icon);
|
||||
@@ -394,7 +394,7 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
|
||||
path = FindImage(wPreferences.icon_path, file);
|
||||
|
||||
if (path && (image = RLoadImage(scr->rcontext, path, 0))) {
|
||||
icon->file_image = wIconValidateIconSize(icon->core->screen_ptr, image);
|
||||
icon->file_image = wIconValidateIconSize(icon->core->screen_ptr, image, wPreferences.icon_size);
|
||||
wIconUpdate(icon);
|
||||
} else {
|
||||
error = 1;
|
||||
@@ -706,7 +706,7 @@ void wIconUpdate(WIcon * icon)
|
||||
}
|
||||
make_icons:
|
||||
|
||||
image = wIconValidateIconSize(scr, image);
|
||||
image = wIconValidateIconSize(scr, image, wPreferences.icon_size);
|
||||
scr->def_icon_pixmap = makeIcon(scr, image, False, False, icon->tile_type, icon->highlighted);
|
||||
scr->def_ticon_pixmap = makeIcon(scr, image, True, False, icon->tile_type, icon->highlighted);
|
||||
if (image)
|
||||
|
||||
@@ -66,7 +66,7 @@ void wIconChangeTitle(WIcon *icon, char *new_title);
|
||||
Bool wIconChangeImageFile(WIcon *icon, char *file);
|
||||
void wIconSelect(WIcon *icon);
|
||||
|
||||
RImage *wIconValidateIconSize(WScreen *scr, RImage *icon);
|
||||
RImage *wIconValidateIconSize(WScreen *scr, RImage *icon, int max_size);
|
||||
|
||||
char *wIconStore(WIcon *icon);
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ static void createPixmaps(WScreen * scr)
|
||||
pix->shared = 1;
|
||||
scr->menu_shade_indicator = pix;
|
||||
|
||||
image = wDefaultGetImage(scr, "Logo", "WMPanel");
|
||||
image = wDefaultGetImage(scr, "Logo", "WMPanel", wPreferences.icon_size);
|
||||
|
||||
if (!image) {
|
||||
wwarning(_("could not load logo image for panels: %s"), RMessageForError(RErrorCode));
|
||||
|
||||
@@ -177,7 +177,7 @@ static void addIconForWindow(WSwitchPanel * panel, WMWidget * parent, WWindow *
|
||||
// it's very likely that most of them are instances of the same thing,
|
||||
// so caching them should get performance acceptable in these cases.
|
||||
if (!image)
|
||||
image = wDefaultGetImage(panel->scr, wwin->wm_instance, wwin->wm_class);
|
||||
image = wDefaultGetImage(panel->scr, wwin->wm_instance, wwin->wm_class, ICON_TILE_SIZE);
|
||||
|
||||
if (!image && !panel->defIcon) {
|
||||
char *file = wDefaultGetIconFile(panel->scr, NULL, NULL, False);
|
||||
|
||||
@@ -399,7 +399,7 @@ char *wDefaultGetIconFile(WScreen * scr, char *instance, char *class, Bool noDef
|
||||
return tmp;
|
||||
}
|
||||
|
||||
RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass)
|
||||
RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_size)
|
||||
{
|
||||
char *file_name;
|
||||
char *path;
|
||||
@@ -422,7 +422,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass)
|
||||
}
|
||||
wfree(path);
|
||||
|
||||
image = wIconValidateIconSize(scr, image);
|
||||
image = wIconValidateIconSize(scr, image, max_size);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user