--- nautilus-directory-background.c	2004-04-13 18:13:15.000000000 +0400
+++ nautilus-directory-background.new	2005-03-07 02:36:47.000000000 +0300
@@ -382,48 +382,6 @@ nautilus_file_background_receive_gconf_c
                           G_CALLBACK (desktop_background_destroyed_callback), NULL);
 }
 
-/* Create a persistent pixmap. We create a separate display
- * and set the closedown mode on it to RetainPermanent
- * (copied from gnome-source/control-panels/capplets/background-properties/render-background.c)
- */
-static GdkPixmap *
-make_root_pixmap (GdkScreen *screen, gint width, gint height)
-{
-	Display *display;
-        const char *display_name;
-	Pixmap result;
-	GdkPixmap *gdk_pixmap;
-	int screen_num;
-
-	screen_num = gdk_screen_get_number (screen);
-
-	gdk_flush ();
-
-	display_name = gdk_display_get_name (gdk_screen_get_display (screen));
-	display = XOpenDisplay (display_name);
-
-        if (display == NULL) {
-                g_warning ("Unable to open display '%s' when setting background pixmap\n",
-                           (display_name) ? display_name : "NULL");
-                return NULL;
-        }
-
-	XSetCloseDownMode (display, RetainPermanent);
-
-	result = XCreatePixmap (display,
-				RootWindow (display, screen_num),
-				width, height,
-				DefaultDepth (display, screen_num));
-
-	XCloseDisplay (display);
-
-	gdk_pixmap = gdk_pixmap_foreign_new (result);
-	gdk_drawable_set_colormap (GDK_DRAWABLE (gdk_pixmap),
-				   gdk_drawable_get_colormap (gdk_screen_get_root_window (screen)));
-
-	return gdk_pixmap;
-}
-
 /* Set the root pixmap, and properties pointing to it. We
  * do this atomically with XGrabServer to make sure that
  * we won't leak the pixmap if somebody else it setting
@@ -498,7 +456,8 @@ image_loading_done_callback (EelBackgrou
 	GdkPixmap    *pixmap;
 	GdkWindow    *background_window;
 	GdkScreen    *screen;
-        GdkColor parsed_color;
+        GdkColor parsed_color, color;
+	 gboolean changed_size;
         char * color_string;
 
         if (GPOINTER_TO_INT (disconnect_signal)) {
@@ -539,16 +498,12 @@ image_loading_done_callback (EelBackgrou
 		}
 	}
 
-        pixmap = make_root_pixmap (screen, pixmap_width, pixmap_height);
+        pixmap = eel_background_get_pixmap_and_color (background, background_window, pixmap_width, pixmap_height, &color, &changed_size);
+
         if (pixmap == NULL) {
                 return;
         }
         
-        gc = gdk_gc_new (pixmap);
-        eel_background_draw (background, pixmap, gc,
-                             0, 0, 0, 0,
-                             pixmap_width, pixmap_height);
-        g_object_unref (gc);
         set_root_pixmap (pixmap, screen);
         g_object_unref (pixmap);
 }
