Skip to content

Commit

Permalink
gtk3 compat for statusicon
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@6193 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 27, 2014
1 parent 02c7500 commit 83e60b9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/xpra/client/gtk_base/statusicon_tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,20 @@ def set_blinking(self, on):


def set_icon_from_data(self, pixels, has_alpha, w, h, rowstride):
tray_icon = gdk.pixbuf_new_from_data(pixels, gdk.COLORSPACE_RGB, has_alpha, 8, w, h, rowstride)
if is_gtk3():
import array
data = array.array('B', pixels)
from gi.repository import GdkPixbuf #@UnresolvedImport
tray_icon = GdkPixbuf.Pixbuf.new_from_data(data, GdkPixbuf.Colorspace.RGB,
True, 8, w, h, rowstride,
None, None)
interp = GdkPixbuf.InterpType.HYPER
else:
tray_icon = gdk.pixbuf_new_from_data(pixels, gdk.COLORSPACE_RGB, has_alpha, 8, w, h, rowstride)
interp = gtk.gdk.INTERP_HYPER
tw, th = self.get_geometry()[2:]
if tw!=w or th!=h:
tray_icon = tray_icon.scale_simple(tw, th, gtk.gdk.INTERP_HYPER)
tray_icon = tray_icon.scale_simple(tw, th, interp)
self.tray_widget.set_from_pixbuf(tray_icon)


Expand Down

0 comments on commit 83e60b9

Please sign in to comment.