Make gnome-screensaver work better with dual-head setup

I have been using the slideshow module of gnome-screensaver on debian. It is a decent screensaver that randomly display a picture from my picture folder. However, with my dualhead setup, the picture is always placed in the center of the two screens. So it is pretty annoying to see people's head get split up by the gap between the two monitors.

So here is a hack that put a picture on both screens:

--- t/gnome-screensaver-2.22.2/savers/gste-slideshow.c	2007-12-12 
13:39:12.000000000 -0800
+++ gnome-screensaver-2.22.2/savers/gste-slideshow.c	2009-05-01 23:58:55.000000000 -0700
@@ -529,10 +529,11 @@
 get_pixbuf_from_local_dir (GSTESlideshow *show,
                            const char    *location)
 {
-        GdkPixbuf *pixbuf, *transformed_pixbuf;
+        GdkPixbuf *pixbuf, *transformed_pixbuf, *new_pixbuf;
         char      *filename;
         int        i;
         GSList    *l;
+        int        w, h;
 
         /* rebuild the cache */
         if (show->priv->filename_list == NULL) {
@@ -568,7 +569,21 @@
         g_free (filename);
         show->priv->filename_list = g_slist_delete_link (show->priv->filename_list, l);
 
-        return transformed_pixbuf;
+        if (transformed_pixbuf) {
+           new_pixbuf = gdk_pixbuf_new(
+               gdk_pixbuf_get_colorspace(transformed_pixbuf),
+               gdk_pixbuf_get_has_alpha(transformed_pixbuf),
+               gdk_pixbuf_get_bits_per_sample(transformed_pixbuf),
+               gdk_pixbuf_get_width(transformed_pixbuf) * 2,
+               gdk_pixbuf_get_height(transformed_pixbuf));
+           w = gdk_pixbuf_get_width(transformed_pixbuf);
+           h = gdk_pixbuf_get_height(transformed_pixbuf);
+           gdk_pixbuf_copy_area(transformed_pixbuf, 0, 0, w, h, new_pixbuf, 0, 0);
+           gdk_pixbuf_copy_area(transformed_pixbuf, 0, 0, w, h, new_pixbuf, w, 0);
+           return new_pixbuf;
+        } else {
+           return NULL;
+        }
 }
 
 static GdkPixbuf *

Comments:

Have comments? Email them to me. I will post it here.