On Wed, 7 Mar 2012 at 1:15:46 +0100, Rodolfo García Peñas wrote:
>
> Subject: [PATCH 3/8] WindowMaker icon.c clean
>
> This commit clean the source.
> ---
> src/icon.c | 50 ++++++++++++++++++++++----------------------------
> 1 files changed, 22 insertions(+), 28 deletions(-)
>
> diff --git a/src/icon.c b/src/icon.c
> index be1b3a7..92c390a 100644
> --- a/src/icon.c
> +++ b/src/icon.c
> @@ -281,31 +281,29 @@ static Pixmap makeIcon(WScreen *scr, RImage *icon, int
> titled, int shadowed, int
> Pixmap pixmap;
> int x, y, sx, sy;
> unsigned w, h;
> - int theight = WMFontHeight(scr->icon_title_font);
> + int theight = 0;
>
> - if (tileType == TILE_NORMAL)
> + if (tileType == TILE_NORMAL) {
> tile = RCloneImage(scr->icon_tile);
> - else {
> + } else {
> assert(scr->clip_tile);
> tile = RCloneImage(scr->clip_tile);
> }
> +
> if (icon) {
> w = (icon->width > wPreferences.icon_size)
> ? wPreferences.icon_size : icon->width;
> x = (wPreferences.icon_size - w) / 2;
> sx = (icon->width - w) / 2;
>
> - if (!titled) {
> - h = (icon->height > wPreferences.icon_size)
> - ? wPreferences.icon_size : icon->height;
> - y = (wPreferences.icon_size - h) / 2;
> - sy = (icon->height - h) / 2;
> - } else {
> - h = (icon->height + theight > wPreferences.icon_size
> - ? wPreferences.icon_size - theight : icon->height);
> - y = theight + ((int)wPreferences.icon_size - theight -
> h) / 2;
> - sy = (icon->height - h) / 2;
> - }
> + if (titled)
> + theight = WMFontHeight(scr->icon_title_font);
> +
> + h = (icon->height + theight > wPreferences.icon_size
> + ? wPreferences.icon_size - theight : icon->height);
> + y = theight + ((int)wPreferences.icon_size - theight - h) / 2;
> + sy = (icon->height - h) / 2;
> +
Cool.
But you should drop the (int) cast because icon_size is already of
int type.
--
To unsubscribe, send mail to [email protected].