about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch
blob: 8130dff1dba44b8c37a5e2f918d330a6561e09af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff -x '*~' -ru compiz-plugins-extra-0.8.6-orig/metadata/wallpaper.xml.in compiz-plugins-extra-0.8.6/metadata/wallpaper.xml.in
--- compiz-plugins-extra-0.8.6-orig/metadata/wallpaper.xml.in	2010-03-29 16:09:17.000000000 +0200
+++ compiz-plugins-extra-0.8.6/metadata/wallpaper.xml.in	2010-10-21 00:23:18.000000000 +0200
@@ -24,7 +24,7 @@
 					<_long>Image position.</_long>
 					<type>int</type>
 					<min>0</min>
-					<max>4</max>
+					<max>5</max>
 					<desc>
 						<value>0</value>
 						<_name>Scale and Crop</_name>
@@ -45,6 +45,10 @@
 						<value>4</value>
 						<_name>Center Tiled</_name>
 					</desc>
+					<desc>
+						<value>5</value>
+						<_name>Centered Maxpect</_name>
+					</desc>
 				</option>
 				<option name="bg_fill_type" type="list">
 					<_short>Fill type</_short>
diff -x '*~' -ru compiz-plugins-extra-0.8.6-orig/src/wallpaper/wallpaper.c compiz-plugins-extra-0.8.6/src/wallpaper/wallpaper.c
--- compiz-plugins-extra-0.8.6-orig/src/wallpaper/wallpaper.c	2010-03-29 16:09:18.000000000 +0200
+++ compiz-plugins-extra-0.8.6/src/wallpaper/wallpaper.c	2010-10-21 01:09:10.000000000 +0200
@@ -697,12 +697,12 @@
 	    tmpMatrix = back->imgTex.matrix;
 
 
-	    if (back->imagePos == BgImagePosScaleAndCrop)
+	    if ((back->imagePos == BgImagePosScaleAndCrop) || (back->imagePos == BgImagePosCenteredMaxpect))
 	    {
 		s1 = (float) s->width / back->width;
 		s2 = (float) s->height / back->height;
 		
-		s1 = MAX (s1, s2);
+		s1 = back->imagePos == BgImagePosScaleAndCrop ? MAX (s1, s2) : MIN (s1, s2);
 
 		tmpMatrix.xx /= s1;
 		tmpMatrix.yy /= s1;
@@ -711,6 +711,16 @@
 		tmpMatrix.x0 -= x * tmpMatrix.xx;
 		y = (s->height - ((int)back->height * s1)) / 2.0;
 		tmpMatrix.y0 -= y * tmpMatrix.yy;
+
+                if (back->imagePos == BgImagePosCenteredMaxpect)
+                {
+                    reg = &tmpRegion;
+		
+                    tmpRegion.extents.x1 = MAX (0, x);
+                    tmpRegion.extents.y1 = MAX (0, y);
+                    tmpRegion.extents.x2 = MIN (s->width, x + ((int) back->width * s1));
+                    tmpRegion.extents.y2 = MIN (s->height, y + ((int) back->height * s1));
+                }
 	    }
 	    else if (back->imagePos == BgImagePosScaled)
 	    {