--- gdm-2.8.0.6/gui/greeter/greeter.c.greeterbackground	2005-10-14 20:23:37.000000000 +0200
+++ gdm-2.8.0.6/gui/greeter/greeter.c	2005-11-21 15:59:16.000000000 +0100
@@ -1226,6 +1224,9 @@
   const char *gdm_gtk_theme;
   guint sid;
   int r;
+  int bg_type;
+  gboolean bg_scale;
+  char *bg_image;
 
   if (g_getenv ("DOING_GDM_DEVELOPMENT") != NULL)
     DOING_GDM_DEVELOPMENT = TRUE;
@@ -1272,8 +1273,14 @@
   /* the background unfilled.   The cursor should be a watch already */
   /* but just in case */
   config   = ve_config_get (config_file);
+  bg_type = ve_config_get_int (config, GDM_KEY_BACKGROUNDTYPE);
+  bg_scale = ve_config_get_bool (config, GDM_KEY_BACKGROUNDSCALETOFIT);
+  bg_image = ve_config_get_string (config, GDM_KEY_BACKGROUNDIMAGE);
+  bg_image = ve_config_get_string (config, GDM_KEY_BACKGROUNDIMAGE);
   bg_color = ve_config_get_string (config, GDM_KEY_BACKGROUNDCOLOR);
-  setup_background_color (bg_color);
+
+  setup_background (bg_type, bg_image, bg_scale, bg_color, gdm_wm_screens, gdm_wm_allscreens);
+
   greeter_session_init ();
 
   ve_signal_add (SIGHUP, greeter_reread_config, NULL);
--- gdm-2.8.0.6/gui/gdmlogin.c.greeterbackground	2005-11-21 14:43:36.000000000 +0100
+++ gdm-2.8.0.6/gui/gdmlogin.c	2005-11-21 15:52:44.000000000 +0100
@@ -109,11 +109,6 @@
 static gboolean GdmBackgroundScaleToFit;
 static gboolean GdmBackgroundRemoteOnlyColor;
 static int GdmBackgroundType;
-enum {
-	GDM_BACKGROUND_NONE = 0,
-	GDM_BACKGROUND_IMAGE = 1,
-	GDM_BACKGROUND_COLOR = 2
-};
 static gchar *GdmGtkRC;
 static gchar *GdmLocaleFile;
 static gchar *GdmGlobalFaceDir;
@@ -3243,141 +3238,6 @@
     }
 }
 
-static void
-set_root (GdkPixbuf *pb)
-{
-	GdkPixmap *pm;
-
-	g_return_if_fail (pb != NULL);
-
-	gdk_pixbuf_render_pixmap_and_mask (pb,
-					   &pm,
-					   NULL /* mask_return */,
-					   0 /* alpha_threshold */);
-
-	/* paranoia */
-	if (pm == NULL)
-		return;
-
-	gdk_error_trap_push ();
-
-	gdk_window_set_back_pixmap (gdk_get_default_root_window (),
-				    pm,
-				    FALSE /* parent_relative */);
-
-	g_object_unref (G_OBJECT (pm));
-
-	gdk_window_clear (gdk_get_default_root_window ());
-
-	gdk_flush ();
-	gdk_error_trap_pop ();
-}
-
-static GdkPixbuf *
-render_scaled_back (const GdkPixbuf *pb)
-{
-	int i;
-	int width, height;
-
-	GdkPixbuf *back = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
-					  gdk_pixbuf_get_has_alpha (pb),
-					  8,
-					  gdk_screen_width (),
-					  gdk_screen_height ());
-
-	width = gdk_pixbuf_get_width (pb);
-	height = gdk_pixbuf_get_height (pb);
-
-	for (i = 0; i < gdm_wm_screens; i++) {
-		gdk_pixbuf_scale (pb, back,
-				  gdm_wm_allscreens[i].x,
-				  gdm_wm_allscreens[i].y,
-				  gdm_wm_allscreens[i].width,
-				  gdm_wm_allscreens[i].height,
-				  gdm_wm_allscreens[i].x /* offset_x */,
-				  gdm_wm_allscreens[i].y /* offset_y */,
-				  (double) gdm_wm_allscreens[i].width / width,
-				  (double) gdm_wm_allscreens[i].height / height,
-				  GDK_INTERP_BILINEAR);
-	}
-
-	return back;
-}
-
-static void
-add_color_to_pb (GdkPixbuf *pb, GdkColor *color)
-{
-	int width = gdk_pixbuf_get_width (pb);
-	int height = gdk_pixbuf_get_height (pb);
-	int rowstride = gdk_pixbuf_get_rowstride (pb);
-	guchar *pixels = gdk_pixbuf_get_pixels (pb);
-	gboolean has_alpha = gdk_pixbuf_get_has_alpha (pb);
-	int i;
-	int cr = color->red >> 8;
-	int cg = color->green >> 8;
-	int cb = color->blue >> 8;
-
-	if ( ! has_alpha)
-		return;
-
-	for (i = 0; i < height; i++) {
-		int ii;
-		guchar *p = pixels + (rowstride * i);
-		for (ii = 0; ii < width; ii++) {
-			int r = p[0];
-			int g = p[1];
-			int b = p[2];
-			int a = p[3];
-
-			p[0] = (r * a + cr * (255 - a)) >> 8;
-			p[1] = (g * a + cg * (255 - a)) >> 8;
-			p[2] = (b * a + cb * (255 - a)) >> 8;
-			p[3] = 255;
-
-			p += 4;
-		}
-	}
-}
-
-/* setup background color/image */
-static void
-setup_background (void)
-{
-	GdkColor color;
-	GdkPixbuf *pb = NULL;
-
-	if (GdmBackgroundType == GDM_BACKGROUND_IMAGE &&
-	    ! ve_string_empty (GdmBackgroundImage))
-		pb = gdk_pixbuf_new_from_file (GdmBackgroundImage, NULL);
-
-	/* Load background image */
-	if (pb != NULL) {
-		if (gdk_pixbuf_get_has_alpha (pb)) {
-			if (GdmBackgroundColor == NULL ||
-			    GdmBackgroundColor[0] == '\0' ||
-			    ! gdk_color_parse (GdmBackgroundColor,
-					       &color)) {
-				gdk_color_parse ("#007777", &color);
-			}
-			add_color_to_pb (pb, &color);
-		}
-		if (GdmBackgroundScaleToFit) {
-			GdkPixbuf *spb = render_scaled_back (pb);
-			g_object_unref (G_OBJECT (pb));
-			pb = spb;
-		}
-
-		/* paranoia */
-		if (pb != NULL) {
-			set_root (pb);
-			g_object_unref (G_OBJECT (pb));
-		}
-	/* Load background color */
-	} else if (GdmBackgroundType != GDM_BACKGROUND_NONE) {
-		setup_background_color (GdmBackgroundColor);
-	}
-}
-
 enum {
 	RESPONSE_RESTART,
 	RESPONSE_REBOOT,
@@ -3438,7 +3298,7 @@
 		GdmBackgroundRemoteOnlyColor = ve_config_get_bool (config, GDM_KEY_BACKGROUNDREMOTEONLYCOLOR);
 
 		gdm_kill_thingies ();
-		setup_background ();
+		setup_background (GdmBackgroundType, GdmBackgroundImage, GdmBackgroundScaleToFit, GdmBackgroundColor, gdm_wm_screens, gdm_wm_allscreens);
 		back_prog_launch_after_timeout ();
 	}
 
@@ -3597,7 +3457,7 @@
     /* Load the background as early as possible so GDM does not leave  */
     /* the background unfilled.   The cursor should be a watch already */
     /* but just in case */
-    setup_background ();
+    setup_background (GdmBackgroundType, GdmBackgroundImage, GdmBackgroundScaleToFit, GdmBackgroundColor, gdm_wm_screens, gdm_wm_allscreens);
     gdm_common_setup_cursor (GDK_WATCH);
 
     if ( ! DOING_GDM_DEVELOPMENT &&
--- gdm-2.8.0.6/gui/gdmcommon.c.greeterbackground	2005-11-21 14:43:45.000000000 +0100
+++ gdm-2.8.0.6/gui/gdmcommon.c	2005-11-21 15:43:32.000000000 +0100
@@ -36,7 +37,6 @@
 
 #include "gdm.h"
 
-#include "gdmwm.h"
 #include "gdmcommon.h"
 #include "gdmcomm.h"
 
@@ -381,4 +381,139 @@
       gdk_error_trap_pop ();
     }
 }
+static void
+set_root (GdkPixbuf *pb)
+{
+	GdkPixmap *pm;
+
+	g_return_if_fail (pb != NULL);
+
+	gdk_pixbuf_render_pixmap_and_mask (pb,
+					   &pm,
+					   NULL /* mask_return */,
+					   0 /* alpha_threshold */);
+
+	/* paranoia */
+	if (pm == NULL)
+		return;
+
+	gdk_error_trap_push ();
+
+	gdk_window_set_back_pixmap (gdk_get_default_root_window (),
+				    pm,
+				    FALSE /* parent_relative */);
+
+	g_object_unref (G_OBJECT (pm));
+
+	gdk_window_clear (gdk_get_default_root_window ());
+
+	gdk_flush ();
+	gdk_error_trap_pop ();
+}
+
+static GdkPixbuf *
+render_scaled_back (const GdkPixbuf *pb, int n_screens, GdkRectangle * allscreens)
+{
+	int i;
+	int width, height;
+
+	GdkPixbuf *back = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+					  gdk_pixbuf_get_has_alpha (pb),
+					  8,
+					  gdk_screen_width (),
+					  gdk_screen_height ());
+
+	width = gdk_pixbuf_get_width (pb);
+	height = gdk_pixbuf_get_height (pb);
+
+	for (i = 0; i < n_screens; i++) {
+		gdk_pixbuf_scale (pb, back,
+				  allscreens[i].x,
+				  allscreens[i].y,
+				  allscreens[i].width,
+				  allscreens[i].height,
+				  allscreens[i].x /* offset_x */,
+				  allscreens[i].y /* offset_y */,
+				  (double) allscreens[i].width / width,
+				  (double) allscreens[i].height / height,
+				  GDK_INTERP_BILINEAR);
+	}
+
+	return back;
+}
+
+static void
+add_color_to_pb (GdkPixbuf *pb, GdkColor *color)
+{
+	int width = gdk_pixbuf_get_width (pb);
+	int height = gdk_pixbuf_get_height (pb);
+	int rowstride = gdk_pixbuf_get_rowstride (pb);
+	guchar *pixels = gdk_pixbuf_get_pixels (pb);
+	gboolean has_alpha = gdk_pixbuf_get_has_alpha (pb);
+	int i;
+	int cr = color->red >> 8;
+	int cg = color->green >> 8;
+	int cb = color->blue >> 8;
+
+	if ( ! has_alpha)
+		return;
+
+	for (i = 0; i < height; i++) {
+		int ii;
+		guchar *p = pixels + (rowstride * i);
+		for (ii = 0; ii < width; ii++) {
+			int r = p[0];
+			int g = p[1];
+			int b = p[2];
+			int a = p[3];
+
+			p[0] = (r * a + cr * (255 - a)) >> 8;
+			p[1] = (g * a + cg * (255 - a)) >> 8;
+			p[2] = (b * a + cb * (255 - a)) >> 8;
+			p[3] = 255;
+
+			p += 4;
+		}
+	}
+}
+
+/* setup background color/image */
+void
+setup_background (int bg_type, gchar *bg_image, gboolean bg_scale_to_fit, gchar *bg_color, 
+		int n_screens, GdkRectangle *allscreens)
+{
+	GdkColor color;
+	GdkPixbuf *pb = NULL;
+
+	if (bg_type == GDM_BACKGROUND_IMAGE &&
+	    ! ve_string_empty (bg_image))
+		pb = gdk_pixbuf_new_from_file (bg_image, NULL);
+
+	/* Load background image */
+	if (pb != NULL) {
+		if (gdk_pixbuf_get_has_alpha (pb)) {
+			if (bg_color== NULL ||
+			    bg_color[0] == '\0' ||
+			    ! gdk_color_parse (bg_color,
+					       &color)) {
+				gdk_color_parse ("#007777", &color);
+			}
+			add_color_to_pb (pb, &color);
+		}
+		if (bg_scale_to_fit) {
+			GdkPixbuf *spb = render_scaled_back (pb, n_screens, allscreens);
+			g_object_unref (G_OBJECT (pb));
+			pb = spb;
+		}
+
+		/* paranoia */
+		if (pb != NULL) {
+			set_root (pb);
+			g_object_unref (G_OBJECT (pb));
+		}
+	/* Load background color */
+	} else if (bg_type != GDM_BACKGROUND_NONE) {
+		setup_background_color (bg_color);
+	}
+}
 
--- gdm-2.8.0.6/gui/gdmcommon.h.greeterbackground	2005-11-21 14:44:44.000000000 +0100
+++ gdm-2.8.0.6/gui/gdmcommon.h	2005-11-21 15:43:49.000000000 +0100
@@ -60,5 +60,11 @@
 gboolean gdm_common_select_time_format	(VeConfig *config);
 
 void setup_background_color (gchar *bg_color);
+enum {
+	GDM_BACKGROUND_NONE = 0,
+	GDM_BACKGROUND_IMAGE = 1,
+	GDM_BACKGROUND_COLOR = 2
+};
+void setup_background (int bg_type, gchar *bg_image, gboolean bg_scale_to_fit, gchar *bg_color, int n_screens, GdkRectangle *allscreens);
 
 #endif /* GDM_COMMON_H */
--- gdm-2.8.0.6/gui/gdmchooser.c.greeterbackground	2005-11-21 15:46:35.000000000 +0100
+++ gdm-2.8.0.6/gui/gdmchooser.c	2005-11-21 15:46:48.000000000 +0100
@@ -181,12 +181,6 @@
 /* */  }
 
 
-enum {
-	GDM_BACKGROUND_NONE = 0,
-	GDM_BACKGROUND_IMAGE = 1,
-	GDM_BACKGROUND_COLOR = 2
-};
-
 static GladeXML *chooser_app;
 static GtkWidget *chooser, *manage, *rescan, *cancel, *add_entry, *add_button;
 static GtkWidget *status_label;
