diff --git a/src/defaults.c b/src/defaults.c index b5ea8e2f..0a353f22 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -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"), diff --git a/src/defaults.h b/src/defaults.h index 2dcf339d..fdf09cdb 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -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, diff --git a/src/icon.c b/src/icon.c index 5660d6b6..be1b3a7c 100644 --- a/src/icon.c +++ b/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) diff --git a/src/icon.h b/src/icon.h index d0f87ec1..97869951 100644 --- a/src/icon.h +++ b/src/icon.h @@ -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); diff --git a/src/screen.c b/src/screen.c index e2cda33b..5c12147f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -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)); diff --git a/src/switchpanel.c b/src/switchpanel.c index 3836991b..aac3a221 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -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); diff --git a/src/wdefaults.c b/src/wdefaults.c index 8df9dc8d..ee42d008 100644 --- a/src/wdefaults.c +++ b/src/wdefaults.c @@ -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; }