[Xfce4-commits] r25701 - in xfdesktop/trunk: settings src

Brian Tarricone kelnos at xfce.org
Fri May 11 03:42:57 CEST 2007


Author: kelnos
Date: 2007-05-11 01:42:56 +0000 (Fri, 11 May 2007)
New Revision: 25701

Modified:
   xfdesktop/trunk/settings/appearance-settings.c
   xfdesktop/trunk/src/xfce-backdrop.c
   xfdesktop/trunk/src/xfce-backdrop.h
Log:
add 'zoomed' option to backdrop styles.  this is a combination scaling/cropping
mode that ensures the backdrop image extends to every edge of the screen
without messing with the aspect ratio.  patch from trondsg at gmail.com (bug 3138)


Modified: xfdesktop/trunk/settings/appearance-settings.c
===================================================================
--- xfdesktop/trunk/settings/appearance-settings.c	2007-05-10 16:13:39 UTC (rev 25700)
+++ xfdesktop/trunk/settings/appearance-settings.c	2007-05-11 01:42:56 UTC (rev 25701)
@@ -738,6 +738,7 @@
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Tiled"));
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Stretched"));
     gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Scaled"));
+    gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Zoomed"));
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo), bp->style);
     gtk_label_set_mnemonic_widget(GTK_LABEL(label), combo);
     gtk_widget_show(combo);

Modified: xfdesktop/trunk/src/xfce-backdrop.c
===================================================================
--- xfdesktop/trunk/src/xfce-backdrop.c	2007-05-10 16:13:39 UTC (rev 25700)
+++ xfdesktop/trunk/src/xfce-backdrop.c	2007-05-11 01:42:56 UTC (rev 25701)
@@ -571,7 +571,7 @@
         if(ih <= h / 2 && iw <= w / 2)
             istyle = XFCE_BACKDROP_IMAGE_TILED;
         else
-            istyle = XFCE_BACKDROP_IMAGE_SCALED;
+            istyle = XFCE_BACKDROP_IMAGE_ZOOMED;
     } else
         istyle = backdrop->priv->image_style;
     
@@ -656,6 +656,22 @@
                     interp, 255);
             break;
         
+        case XFCE_BACKDROP_IMAGE_ZOOMED:
+            xscale = (gdouble)w / iw;
+            yscale = (gdouble)h / ih;
+            if(xscale < yscale) {
+                xscale = yscale;
+                xo = (w - (iw * xscale)) * 0.5;
+                yo = 0;
+            } else {
+                yscale = xscale;
+                xo = 0;
+                yo = (h - (ih * yscale)) * 0.5;
+            }
+            gdk_pixbuf_composite(image, final_image, 0, 0,
+                    w, h, xo, yo, xscale, yscale, interp, 255);
+            break;
+        
         default:
             g_critical("Invalid image style: %d\n", (gint)istyle);
     }

Modified: xfdesktop/trunk/src/xfce-backdrop.h
===================================================================
--- xfdesktop/trunk/src/xfce-backdrop.h	2007-05-10 16:13:39 UTC (rev 25700)
+++ xfdesktop/trunk/src/xfce-backdrop.h	2007-05-11 01:42:56 UTC (rev 25701)
@@ -48,7 +48,8 @@
     XFCE_BACKDROP_IMAGE_CENTERED,
     XFCE_BACKDROP_IMAGE_TILED,
     XFCE_BACKDROP_IMAGE_STRETCHED,
-    XFCE_BACKDROP_IMAGE_SCALED
+    XFCE_BACKDROP_IMAGE_SCALED,
+    XFCE_BACKDROP_IMAGE_ZOOMED
 } XfceBackdropImageStyle;
 
 typedef enum



More information about the Xfce4-commits mailing list