changeset 10765:80b8be10dc42

[gaim-migrate @ 12370] This makes the system tray icon transparent on linux. Try sticking this in your ~/.gtkrc-2.0 to test it with: style "background-color" { bg[NORMAL] = "#FF00FF" bg[ACTIVE] = "#FF00FF" bg[SELECTED] = "#FF0000" } widget_class "*" style "background-color" One problem is the icon has a shadow thats probably just a little more gradual than needed. causing things to look funny. It might be better than nothing though. And if now we can revert it. So people play with this and decide if it sucks or not. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Fri, 01 Apr 2005 23:16:50 +0000
parents c3b709d6d1e7
children 4e64283bf3cb
files plugins/docklet/docklet-x11.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/docklet/docklet-x11.c	Fri Apr 01 21:38:02 2005 +0000
+++ b/plugins/docklet/docklet-x11.c	Fri Apr 01 23:16:50 2005 +0000
@@ -87,6 +87,8 @@
 docklet_x11_update_icon(enum docklet_status icon)
 {
 	const gchar *icon_name = NULL;
+	GdkPixbuf *p;
+	GdkBitmap *mask = NULL;
 
 	g_return_if_fail(image != NULL);
 
@@ -113,6 +115,29 @@
 	}
 
 	gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+	p = gtk_widget_render_icon(GTK_WIDGET(image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
+
+	if (p && (gdk_pixbuf_get_colorspace(p) == GDK_COLORSPACE_RGB) && (gdk_pixbuf_get_bits_per_sample(p) == 8)
+	   && (gdk_pixbuf_get_has_alpha(p)) && (gdk_pixbuf_get_n_channels(p) == 4)) {
+		int len = gdk_pixbuf_get_width(p) * gdk_pixbuf_get_height(p);
+		guchar *data = gdk_pixbuf_get_pixels(p);
+		guchar *bitmap = g_malloc((len / 8) + 1);
+		int i;
+
+		for (i = 0; i < len; i++)
+			if ((data[i*4] != 0) || (data[i*4 + 1] != 0) || (data[i*4 + 2] != 0) || (data[i*4 + 3] != 0))
+				bitmap[i/8] |= 1 << i % 8;
+			else
+				bitmap[i/8] &= ~(1 << i % 8);
+
+		mask = gdk_bitmap_create_from_data(GDK_DRAWABLE(GTK_WIDGET(image)->window), bitmap, gdk_pixbuf_get_width(p), gdk_pixbuf_get_height(p));
+		g_free(bitmap);
+	}
+
+	if (mask)
+		gdk_window_shape_combine_mask(image->window, mask, 0, 0);
+
+	g_object_unref(G_OBJECT(p));
 }
 
 static void