--- a/mahjongg/drawing.c	2008-05-07 20:56:36.000000000 -0400
+++ b/mahjongg/drawing.c	2008-05-08 23:19:41.000000000 -0400
@@ -47,18 +47,21 @@ GdkPixmap *buffer = NULL;
 GdkPixmap *tileimages = NULL;
 GdkPixmap *tilebuffer = NULL;
 GdkBitmap *tilemask = NULL;
-
+GdkPixmap *bgbuffer = NULL;
 GdkGC *gc = NULL;
 
 gboolean update_tileimages = TRUE;
 gboolean nowindow = TRUE;
 
 GdkColor bgcolour;
+guint32  bgrgba = 0;
 
 GamesPreimage *tilepreimage = NULL;
 
 static gint windowwidth;
 static gint windowheight;
+GdkPixbuf *bgPixBuf = NULL;
+GdkPixbuf *bgClearPixBuf = NULL;
 gint prior_tilebasewidth = 0;
 gint tilebasewidth = 0;
 gint tilebaseheight = 0;
@@ -193,15 +196,56 @@ find_tile (guint x, guint y)
 void
 set_background (gchar * colour)
 {
+
   if (!colour || !gdk_color_parse (colour, &bgcolour)) {
     bgcolour.red = bgcolour.green = bgcolour.blue = 0;
   }
 
   if (gc) {
-    gdk_colormap_alloc_color (gdk_colormap_get_system (), &bgcolour, FALSE,
+    gdk_colormap_alloc_color (gdk_gc_get_colormap(gc), &bgcolour, FALSE,
 			      TRUE);
     gdk_gc_set_foreground (gc, &bgcolour);
   }
+
+  if (nowindow)
+    return;
+
+  if (bgPixBuf != NULL)
+    g_object_unref (bgPixBuf);
+
+  if (bgClearPixBuf != NULL)
+    g_object_unref (bgClearPixBuf);
+
+  if (bgbuffer != NULL)
+    g_object_unref (bgbuffer);
+
+  bgbuffer = gdk_pixmap_new (board->window, windowwidth, windowheight, -1);
+
+  bgPixBuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+			 windowwidth, windowheight);
+
+  bgrgba = ((bgcolour.red >> 8) << 24) 
+          + ((bgcolour.green >> 8) << 16)
+          + ((bgcolour.blue >> 8) << 8)
+          + (guint32) 0x00000070;
+
+  gdk_pixbuf_fill (bgPixBuf, bgrgba); //RGBA
+
+  bgClearPixBuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+			 windowwidth, windowheight);
+  gdk_pixbuf_fill (bgClearPixBuf, 0x00000000); //RGBA
+
+
+  gdk_draw_pixbuf (bgbuffer, NULL, bgClearPixBuf,
+                    0, 0, 0, 0, windowwidth, windowheight,
+                    GDK_RGB_DITHER_NONE, 0, 0);
+
+  gdk_draw_pixbuf (bgbuffer, NULL, bgPixBuf,
+                    0, 0, 0, 0, windowwidth, windowheight,
+                    GDK_RGB_DITHER_NONE, 0, 0);
+
+
+
 }
 
 void
@@ -217,7 +261,13 @@ draw_tile (gint tileno)
   gdk_gc_set_clip_mask (gc, tilemask);
   gdk_gc_set_clip_origin (gc, 0, 0);
 
-  gdk_draw_rectangle (tilebuffer, gc, TRUE, 0, 0, tilewidth, tileheight);
+
+  if (bgbuffer != NULL) {
+     gdk_draw_drawable (tilebuffer, gc, bgbuffer,
+		        0, 0, 0, 0, tilewidth, tileheight);
+  } else {
+     gdk_draw_rectangle (tilebuffer, gc, TRUE, 0, 0, tilewidth, tileheight);
+  }
 
   for (i = view_geometry[tileno].noverlaps - 1; i >= 0; i--) {
     j = view_geometry[tileno].overlaps[i];
@@ -249,8 +299,14 @@ draw_all_tiles (void)
   guint sx, sy;
   guint dx, dy;
 
-  gdk_gc_set_clip_mask (gc, NULL);
-  gdk_draw_rectangle (buffer, gc, TRUE, 0, 0, windowwidth, windowheight);
+  if (bgbuffer != NULL) {
+     gdk_gc_set_clip_mask (gc, NULL);
+     gdk_draw_drawable (buffer, gc, bgbuffer,
+		        0, 0, 0, 0, windowwidth, windowheight);
+  } else {
+    gdk_gc_set_clip_mask (gc, NULL);
+    gdk_draw_rectangle (buffer, gc, FALSE, 0, 0, windowwidth, windowheight);
+  }
 
   /* This works because of the way the tiles are sorted. We could
    * reverse them to make this look a little nicer, but when searching
@@ -344,8 +400,43 @@ configure_pixmaps (void)
 
   if (buffer != NULL)
     g_object_unref (buffer);
+
+  if (bgPixBuf != NULL)
+    g_object_unref (bgPixBuf);
+
+  if (bgClearPixBuf != NULL)
+    g_object_unref (bgClearPixBuf);
+
   buffer = gdk_pixmap_new (board->window, windowwidth, windowheight, -1);
 
+  if (bgbuffer != NULL)
+    g_object_unref (bgbuffer);
+
+  bgrgba = ((bgcolour.red >> 8) << 24) 
+          + ((bgcolour.green >> 8) << 16)
+          + ((bgcolour.blue >> 8) << 8)
+          + (guint32) 0x00000070;
+
+  bgbuffer = gdk_pixmap_new (board->window, windowwidth, windowheight, -1);
+
+  bgPixBuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+			 windowwidth, windowheight);
+
+  gdk_pixbuf_fill (bgPixBuf, bgrgba); //RGBA
+
+  bgClearPixBuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+			 windowwidth, windowheight);
+  gdk_pixbuf_fill (bgClearPixBuf, 0x00000000); //RGBA
+
+  gdk_draw_pixbuf (bgbuffer, NULL, bgClearPixBuf,
+                    0, 0, 0, 0, windowwidth, windowheight,
+                    GDK_RGB_DITHER_NONE, 0, 0);
+
+  gdk_draw_pixbuf (bgbuffer, NULL, bgPixBuf,
+                    0, 0, 0, 0, windowwidth, windowheight,
+                    GDK_RGB_DITHER_NONE, 0, 0);
+
+
   /* Recreate the tile images only if the theme or tile size changed. */
   if ((prior_tilebasewidth != tilebasewidth) || (update_tileimages)) {
 
@@ -366,6 +457,7 @@ configure_pixmaps (void)
   }
 }
 
+
 /* Here is where we create the backing pixmap and set up the tile pixmaps. */
 static gboolean
 configure_board (GtkWidget * w, GdkEventConfigure * e, gpointer data)
@@ -375,7 +467,7 @@ configure_board (GtkWidget * w, GdkEvent
   if (gc == NULL) {
     gc = gdk_gc_new (w->window);
     gdk_gc_copy (gc, w->style->black_gc);
-    gdk_colormap_alloc_color (gdk_colormap_get_system (), &bgcolour, FALSE,
+    gdk_colormap_alloc_color (gdk_gc_get_colormap(gc), &bgcolour, FALSE,
 			      TRUE);
     gdk_gc_set_foreground (gc, &bgcolour);
   }
@@ -394,9 +486,9 @@ configure_board (GtkWidget * w, GdkEvent
 static void
 expose_board (GtkWidget * w, GdkEventExpose * e, gpointer data)
 {
-  gdk_draw_drawable (w->window, w->style->black_gc, buffer, e->area.x,
-		     e->area.y, e->area.x, e->area.y, e->area.width,
-		     e->area.height);
+    gdk_draw_drawable (w->window, w->style->black_gc, buffer, e->area.x,
+   		     e->area.y, e->area.x, e->area.y, e->area.width,
+   		     e->area.height);
 }
 
 static void


