diff --git a/ChangeLog b/ChangeLog index 0017740..14c88d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2324,3 +2324,9 @@ Fri Aug 20 16:05:59 PDT 1999 Michael Jennings line should no longer generate a parse error. =) ------------------------------------------------------------------------------- +Fri Aug 20 17:28:24 PDT 1999 Michael Jennings + + Fixed a small bug in icon size handling located by Hubert Verstraete + . + +------------------------------------------------------------------------------- diff --git a/src/pixmap.c b/src/pixmap.c index 945c9c3..3700153 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -1109,7 +1109,7 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints) if (icon_path != NULL) { XIconSize *icon_sizes; - int count, i, w = 64, h = 64; + int count, i, w = 8, h = 8; /* At least 8x8 */ temp_im = Imlib_load_image(imlib_id, (char *) icon_path); /* If we're going to render the image anyway, might as well be nice and give it to the WM in a size it likes. */ @@ -1117,12 +1117,20 @@ set_icon_pixmap(char *filename, XWMHints * pwm_hints) for (i = 0; i < count; i++) { D_PIXMAP(("Got icon sizes: Width %d to %d +/- %d, Height %d to %d +/- %d\n", icon_sizes[i].min_width, icon_sizes[i].max_width, icon_sizes[i].width_inc, icon_sizes[i].min_height, icon_sizes[i].max_height, icon_sizes[i].height_inc)); - w = MIN(icon_sizes[i].max_width, 64); /* 64x64 is plenty big */ - h = MIN(icon_sizes[i].max_height, 64); + if (icon_sizes[i].max_width > 64 || icon_sizes[i].max_height > 64) { + continue; + } + /* Find the largest supported size <= 64 */ + w = MAX(icon_sizes[i].max_width, w); + h = MAX(icon_sizes[i].max_height, h); } fflush(stdout); XFree(icon_sizes); + } else { + w = h = 48; } + MIN_IT(w, 64); + MIN_IT(h, 64); Imlib_render(imlib_id, temp_im, w, h); wm_hints->icon_pixmap = Imlib_copy_image(imlib_id, temp_im); wm_hints->icon_mask = Imlib_copy_mask(imlib_id, temp_im);