wok-current rev 416
JWM: resize backgound without respecting ratio width/height
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Mar 12 19:24:20 2008 +0000 (2008-03-12) |
parents | 7e80631728ec |
children | c05ff7572e16 |
files | jwm/receipt jwm/stuff/resize-backgound.u |
line diff
1.1 --- a/jwm/receipt Wed Mar 12 16:52:59 2008 +0100 1.2 +++ b/jwm/receipt Wed Mar 12 19:24:20 2008 +0000 1.3 @@ -6,6 +6,7 @@ 1.4 SHORT_DESC="JWM is a light Window Manager for the X window system." 1.5 MAINTAINER="pankso@slitaz.org" 1.6 DEPENDS="xorg" 1.7 +BUILD_DEPENDS="xorg-dev xorg-libXft-dev jpeg-dev" 1.8 TARBALL="$PACKAGE-$VERSION.tar.bz2" 1.9 WEB_SITE="http://www.joewing.net/programs/jwm/" 1.10 WGET_URL="http://www.joewing.net/programs/jwm/releases/$TARBALL" 1.11 @@ -14,6 +15,7 @@ 1.12 compile_rules() 1.13 { 1.14 cd $src 1.15 + patch -p1 < ../stuff/resize-backgound.u 1.16 ./configure \ 1.17 --prefix=/usr \ 1.18 --mandir=/usr/share/man \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/jwm/stuff/resize-backgound.u Wed Mar 12 19:24:20 2008 +0000 2.3 @@ -0,0 +1,63 @@ 2.4 +--- jwm-2.0.1/src/icon.c 2.5 ++++ jwm-2.0.1/src/icon.c 2.6 +@@ -55,3 +55,3 @@ 2.7 + 2.8 +-static ScaledIconNode *GetScaledIcon(IconNode *icon, int width, int height); 2.9 ++static ScaledIconNode *_GetScaledIcon(IconNode *icon, int width, int height); 2.10 + 2.11 +@@ -194,8 +194,26 @@ 2.12 + int ix, iy; 2.13 ++ int nwidth = width, nheight = height; 2.14 + 2.15 + Assert(icon); 2.16 ++ Assert(icon->image); 2.17 + 2.18 +- /* Scale the icon. */ 2.19 +- node = GetScaledIcon(icon, width, height); 2.20 ++ if(nwidth == 0) { 2.21 ++ nwidth = icon->image->width; 2.22 ++ } 2.23 ++ if(nheight == 0) { 2.24 ++ nheight = icon->image->height; 2.25 ++ } 2.26 + 2.27 ++ /* respect ratio if not background */ 2.28 ++ if (x || y) { 2.29 ++ double ratio; 2.30 ++ 2.31 ++ ratio = (double)icon->image->width / icon->image->height; 2.32 ++ nwidth = Min(nwidth, nheight * ratio); 2.33 ++ nheight = Min(nheight, nwidth / ratio); 2.34 ++ nwidth = nheight * ratio; 2.35 ++ } 2.36 ++ 2.37 ++ node = _GetScaledIcon(icon, nwidth, nheight); 2.38 ++ 2.39 + if(node) { 2.40 +@@ -450,3 +468,3 @@ 2.41 + /** Get a scaled icon. */ 2.42 +-ScaledIconNode *GetScaledIcon(IconNode *icon, int rwidth, int rheight) { 2.43 ++ScaledIconNode *_GetScaledIcon(IconNode *icon, int nwidth, int nheight) { 2.44 + 2.45 +@@ -460,4 +478,2 @@ 2.46 + double srcx, srcy; 2.47 +- double ratio; 2.48 +- int nwidth, nheight; 2.49 + int usesMask; 2.50 +@@ -465,16 +481,2 @@ 2.51 + 2.52 +- Assert(icon); 2.53 +- Assert(icon->image); 2.54 +- 2.55 +- if(rwidth == 0) { 2.56 +- rwidth = icon->image->width; 2.57 +- } 2.58 +- if(rheight == 0) { 2.59 +- rheight = icon->image->height; 2.60 +- } 2.61 +- 2.62 +- ratio = (double)icon->image->width / icon->image->height; 2.63 +- nwidth = Min(rwidth, rheight * ratio); 2.64 +- nheight = Min(rheight, nwidth / ratio); 2.65 +- nwidth = nheight * ratio; 2.66 + if(nwidth < 1) {