/* sets a widget background pixmap to reveal possible GDK/Cairo/X.org bugs */

#include <gtk/gtk.h>

int
main (int    argc,
      char **argv)
{
	GdkPixbuf *pixbuf;
	GdkPixmap *pixmap;
	GtkWidget *win;
	GtkWidget *darea;
	GError *error;

	gtk_init (&argc, &argv);

	error = NULL;
	pixbuf = gdk_pixbuf_new_from_file ("/usr/share/nautilus/patterns/blue_ridge.png", &error);
	if (error != NULL || pixbuf == NULL) {
		g_warning ("error while loading pattern: %s", error->message ? error->message : "pixbuf is NULL");
		return 1;
	}

	win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (win), "Testing...");
	gtk_window_present (GTK_WINDOW (win));

	darea = gtk_drawing_area_new ();
	gtk_container_add (GTK_CONTAINER (win), darea);
	gtk_widget_show (darea);

	gdk_pixbuf_render_pixmap_and_mask_for_colormap
		(GDK_PIXBUF (pixbuf),
		 gtk_widget_get_colormap (darea),
		 &pixmap, NULL, 0);
	gdk_window_set_back_pixmap (darea->window, pixmap, FALSE);
	gdk_window_clear (darea->window);

	gtk_main ();
}
