# HG changeset patch # User Pascal Bellard # Date 1205349860 0 # Node ID 5a403db80cf8081e78c689c2e1da65db41949f8b # Parent 7e80631728ec553456a20e86ecc27eff9ccbe4f7 JWM: resize backgound without respecting ratio width/height diff -r 7e80631728ec -r 5a403db80cf8 jwm/receipt --- a/jwm/receipt Wed Mar 12 16:52:59 2008 +0100 +++ b/jwm/receipt Wed Mar 12 19:24:20 2008 +0000 @@ -6,6 +6,7 @@ SHORT_DESC="JWM is a light Window Manager for the X window system." MAINTAINER="pankso@slitaz.org" DEPENDS="xorg" +BUILD_DEPENDS="xorg-dev xorg-libXft-dev jpeg-dev" TARBALL="$PACKAGE-$VERSION.tar.bz2" WEB_SITE="http://www.joewing.net/programs/jwm/" WGET_URL="http://www.joewing.net/programs/jwm/releases/$TARBALL" @@ -14,6 +15,7 @@ compile_rules() { cd $src + patch -p1 < ../stuff/resize-backgound.u ./configure \ --prefix=/usr \ --mandir=/usr/share/man \ diff -r 7e80631728ec -r 5a403db80cf8 jwm/stuff/resize-backgound.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jwm/stuff/resize-backgound.u Wed Mar 12 19:24:20 2008 +0000 @@ -0,0 +1,63 @@ +--- jwm-2.0.1/src/icon.c ++++ jwm-2.0.1/src/icon.c +@@ -55,3 +55,3 @@ + +-static ScaledIconNode *GetScaledIcon(IconNode *icon, int width, int height); ++static ScaledIconNode *_GetScaledIcon(IconNode *icon, int width, int height); + +@@ -194,8 +194,26 @@ + int ix, iy; ++ int nwidth = width, nheight = height; + + Assert(icon); ++ Assert(icon->image); + +- /* Scale the icon. */ +- node = GetScaledIcon(icon, width, height); ++ if(nwidth == 0) { ++ nwidth = icon->image->width; ++ } ++ if(nheight == 0) { ++ nheight = icon->image->height; ++ } + ++ /* respect ratio if not background */ ++ if (x || y) { ++ double ratio; ++ ++ ratio = (double)icon->image->width / icon->image->height; ++ nwidth = Min(nwidth, nheight * ratio); ++ nheight = Min(nheight, nwidth / ratio); ++ nwidth = nheight * ratio; ++ } ++ ++ node = _GetScaledIcon(icon, nwidth, nheight); ++ + if(node) { +@@ -450,3 +468,3 @@ + /** Get a scaled icon. */ +-ScaledIconNode *GetScaledIcon(IconNode *icon, int rwidth, int rheight) { ++ScaledIconNode *_GetScaledIcon(IconNode *icon, int nwidth, int nheight) { + +@@ -460,4 +478,2 @@ + double srcx, srcy; +- double ratio; +- int nwidth, nheight; + int usesMask; +@@ -465,16 +481,2 @@ + +- Assert(icon); +- Assert(icon->image); +- +- if(rwidth == 0) { +- rwidth = icon->image->width; +- } +- if(rheight == 0) { +- rheight = icon->image->height; +- } +- +- ratio = (double)icon->image->width / icon->image->height; +- nwidth = Min(rwidth, rheight * ratio); +- nheight = Min(rheight, nwidth / ratio); +- nwidth = nheight * ratio; + if(nwidth < 1) {