summary refs log tree commit diff
path: root/pkgs/applications/window-managers/compiz
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2010-10-20 23:16:51 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2010-10-20 23:16:51 +0000
commit23914238d14aeb9eb08cab85f09a5c8cf4191078 (patch)
treeb099fbbd674e0dd84d8b53578b1ad4af54b9fb6b /pkgs/applications/window-managers/compiz
parentedc04aeef5294ca6d9a822dad26e0b2333e159f6 (diff)
downloadnixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.tar
nixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.tar.gz
nixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.tar.bz2
nixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.tar.lz
nixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.tar.xz
nixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.tar.zst
nixpkgs-23914238d14aeb9eb08cab85f09a5c8cf4191078.zip
* compiz-plugins-extra: Wrote a patch to add "centered maxpect"
  scaling mode for background images (as in KDE), i.e., scale the
  image to the maximum size while preserving its aspect ratio.

svn path=/nixpkgs/trunk/; revision=24394
Diffstat (limited to 'pkgs/applications/window-managers/compiz')
-rw-r--r--pkgs/applications/window-managers/compiz/plugins-extra.nix6
-rw-r--r--pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch58
2 files changed, 64 insertions, 0 deletions
diff --git a/pkgs/applications/window-managers/compiz/plugins-extra.nix b/pkgs/applications/window-managers/compiz/plugins-extra.nix
index 65a0be2da99..18b779d9b49 100644
--- a/pkgs/applications/window-managers/compiz/plugins-extra.nix
+++ b/pkgs/applications/window-managers/compiz/plugins-extra.nix
@@ -11,6 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "1qbxfi332bbadm0ah48frnrl9dkczl111s5a91a0cqz5v7nbw4g1";
   };
 
+  patches =
+    [ # Support scaling wallpapers to the maximum size while still
+      # respecting the aspect ratio.
+      ./wallpaper-maxpect.patch
+    ];
+
   NIX_CFLAGS_COMPILE = "-I${compiz_plugins_main}/include/compiz";
 
   buildInputs =
diff --git a/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch b/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch
new file mode 100644
index 00000000000..8130dff1dba
--- /dev/null
+++ b/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch
@@ -0,0 +1,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)
+ 	    {