Author: eelco
Date: Wed Oct 20 23:16:51 2010
New Revision: 24394
URL: https://svn.nixos.org/websvn/nix/?rev=24394&sc=1

Log:
* 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.

Added:
   
nixpkgs/trunk/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch
Modified:
   nixpkgs/trunk/pkgs/applications/window-managers/compiz/plugins-extra.nix

Modified: 
nixpkgs/trunk/pkgs/applications/window-managers/compiz/plugins-extra.nix
==============================================================================
--- nixpkgs/trunk/pkgs/applications/window-managers/compiz/plugins-extra.nix    
Wed Oct 20 22:42:48 2010        (r24393)
+++ nixpkgs/trunk/pkgs/applications/window-managers/compiz/plugins-extra.nix    
Wed Oct 20 23:16:51 2010        (r24394)
@@ -11,6 +11,12 @@
     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 =

Added: 
nixpkgs/trunk/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
nixpkgs/trunk/pkgs/applications/window-managers/compiz/wallpaper-maxpect.patch  
    Wed Oct 20 23:16:51 2010        (r24394)
@@ -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)
+           {
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to