Index: eggstatusicon.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/tray/eggstatusicon.c,v
retrieving revision 1.2
diff -u -8 -r1.2 eggstatusicon.c
--- eggstatusicon.c	15 Apr 2003 04:45:59 -0000	1.2
+++ eggstatusicon.c	21 Aug 2004 15:58:33 -0000
@@ -260,16 +260,19 @@
   g_signal_connect_swapped (status_icon->priv->tray_icon, "button-press-event",
 			    G_CALLBACK (egg_status_icon_button_press), status_icon);
   g_signal_connect_swapped (status_icon->priv->tray_icon, "button-release-event",
 			    G_CALLBACK (egg_status_icon_button_release), status_icon);
 
   status_icon->priv->image = gtk_image_new ();
   gtk_container_add (GTK_CONTAINER (status_icon->priv->tray_icon),
 		     status_icon->priv->image);
+  /* Make sure the image aligns to the top-left corner, so that when we set
+     the window's shape mask at 0x0, it will match the icon's position. */
+  gtk_misc_set_alignment (GTK_MISC (status_icon->priv->image), 0, 0);
 
   g_signal_connect_swapped (status_icon->priv->image, "size-allocate",
 			    G_CALLBACK (egg_status_icon_size_allocate), status_icon);
 
   gtk_widget_show (status_icon->priv->image);
   gtk_widget_show (status_icon->priv->tray_icon);
 
   status_icon->priv->tooltips = gtk_tooltips_new ();
@@ -507,16 +510,26 @@
 						  GDK_INTERP_BILINEAR);
 	      }
 	    else
 	      {
 		scaled = g_object_ref (pixbuf);
 	      }
 
 	    gtk_image_set_from_pixbuf (GTK_IMAGE (status_icon->priv->image), scaled);
+
+            /* Sets the icon's transparency mask as the window's shape mask */
+            /* TODO: Ensure proper blending of translucent icons */
+            GdkBitmap* scaled_mask = NULL;
+            gdk_pixbuf_render_pixmap_and_mask(scaled, NULL, &scaled_mask, 255);
+            if (scaled_mask)
+            {
+               gtk_widget_shape_combine_mask(GTK_WIDGET(status_icon->priv->tray_icon), scaled_mask, 0, 0);
+               g_object_unref(scaled_mask);
+            }
 
 	    g_object_unref (scaled);
 	  }
 	else
 	  {
 	    gtk_image_set_from_pixbuf (GTK_IMAGE (status_icon->priv->image), NULL);
 	  }
       }
