wok-stable view jwm/stuff/resize-backgound.u @ rev 1667
Add perl-authen-sasl
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Nov 08 13:54:28 2008 +0000 (2008-11-08) |
parents | |
children |
line source
1 --- jwm-2.0.1/src/icon.c
2 +++ jwm-2.0.1/src/icon.c
3 @@ -55,3 +55,3 @@
5 -static ScaledIconNode *GetScaledIcon(IconNode *icon, int width, int height);
6 +static ScaledIconNode *_GetScaledIcon(IconNode *icon, int width, int height);
8 @@ -194,8 +194,26 @@
9 int ix, iy;
10 + int nwidth = width, nheight = height;
12 Assert(icon);
13 + Assert(icon->image);
15 - /* Scale the icon. */
16 - node = GetScaledIcon(icon, width, height);
17 + if(nwidth == 0) {
18 + nwidth = icon->image->width;
19 + }
20 + if(nheight == 0) {
21 + nheight = icon->image->height;
22 + }
24 + /* respect ratio if not background */
25 + if (x || y) {
26 + double ratio;
27 +
28 + ratio = (double)icon->image->width / icon->image->height;
29 + nwidth = Min(nwidth, nheight * ratio);
30 + nheight = Min(nheight, nwidth / ratio);
31 + nwidth = nheight * ratio;
32 + }
33 +
34 + node = _GetScaledIcon(icon, nwidth, nheight);
35 +
36 if(node) {
37 @@ -450,3 +468,3 @@
38 /** Get a scaled icon. */
39 -ScaledIconNode *GetScaledIcon(IconNode *icon, int rwidth, int rheight) {
40 +ScaledIconNode *_GetScaledIcon(IconNode *icon, int nwidth, int nheight) {
42 @@ -460,4 +478,2 @@
43 double srcx, srcy;
44 - double ratio;
45 - int nwidth, nheight;
46 int usesMask;
47 @@ -465,16 +481,2 @@
49 - Assert(icon);
50 - Assert(icon->image);
51 -
52 - if(rwidth == 0) {
53 - rwidth = icon->image->width;
54 - }
55 - if(rheight == 0) {
56 - rheight = icon->image->height;
57 - }
58 -
59 - ratio = (double)icon->image->width / icon->image->height;
60 - nwidth = Min(rwidth, rheight * ratio);
61 - nheight = Min(rheight, nwidth / ratio);
62 - nwidth = nheight * ratio;
63 if(nwidth < 1) {