smart+question
it's egg.trayicon pb. gtk3 will fix it (hopefully) but it's long coming
there are two possibilites for us to have it now:
import egg.trayicon as trayicon
import gtk
t = trayicon.TrayIcon('Gajim')
eb = gtk.EventBox()
# avoid draw seperate bg color in some gtk themes
#eb.set_visible_window(False)
#eb.show()
#eb.window.set_back_pixmap(None, True)
img_tray = gtk.Image()
img_tray.set_from_file('/tmp/aMule.xpm')
eb.add(img_tray)
t.add(eb)
t.show_all()
#eb.window.set_back_pixmap(None, False)
style = eb.style.copy()
style.bg_pixmap[gtk.STATE_NORMAL] = 1L # or better gtk.gdk.PARENT_RELATIVE
eb.set_style(style)
style.set_background(eb.window, gtk.STATE_NORMAL)
gtk.main()
this is untested cause of pygtk bug: http://bugzilla.gnome.org/show_bug.cgi?id=320248
or someone to pythonize:
void CSysTray::SetTrayIcon(char** data, int* pVals)
{
if(m_DesktopMode==dmDisabled)
return;
if(m_status_image==NULL)
return; // nothing you can do..
GdkPixmap* oldpix,*oldbit;
GdkPixmap* newpix,*newbit;
/* set new */
gtk_pixmap_get(GTK_PIXMAP(m_status_image),&oldpix,&oldbit);
newpix=gdk_pixmap_create_from_xpm_d(m_status_docklet->window,&newbit,NULL,data);
/* create pixmap for meters */
GdkPixmap *meterpix=gdk_pixmap_new(m_status_docklet->window,22,22,-1);
GdkBitmap* meterbit=gdk_pixmap_new(m_status_docklet->window,22,22,1);
/* draw meters */
drawMeters(meterpix,meterbit,pVals);
/* then draw meters onto main pix */
GdkGC* mygc=gdk_gc_new(newpix);
gdk_gc_set_clip_mask(mygc,meterbit);
gdk_draw_pixmap(newpix,mygc,meterpix,0,0,0,0,22,22);
gdk_gc_set_clip_mask(mygc,NULL);
gdk_gc_unref(mygc);
/* finally combine masks */
mygc=gdk_gc_new(newbit);
gdk_gc_set_function(mygc,GDK_OR);
gdk_draw_pixmap(newbit,mygc,meterbit,0,0,0,0,22,22);
gdk_gc_unref(mygc);
gdk_pixmap_unref(meterpix);
gdk_bitmap_unref(meterbit);
gtk_pixmap_set(GTK_PIXMAP(m_status_image),newpix,newbit);
/* free old */
gdk_pixmap_unref(oldpix);
gdk_bitmap_unref(oldbit);
/* and force repaint */
gtk_widget_draw(m_status_docklet,NULL);
which is from amule/gtk and it works. it creates a clipping mask which holds which pixels are transparent and which not
pygtk implementation pending, and it should work with our png without a pb