diff --git a/src/install.rdf b/src/install.rdf index 7f432a8..7cc8a13 100644 --- a/src/install.rdf +++ b/src/install.rdf @@ -5,7 +5,7 @@ true 2 FireTray - 0.4.0a2 + 0.4.0a3 Hua Luo, Francesco Solero, Foudil BRÉTEL Hua Luo, Francesco Solero (Firetray original authors) https://github.com/foudfou/firetray diff --git a/src/modules/FiretrayIconLinux.jsm b/src/modules/FiretrayIconLinux.jsm index f0ef805..f1670f2 100644 --- a/src/modules/FiretrayIconLinux.jsm +++ b/src/modules/FiretrayIconLinux.jsm @@ -201,7 +201,7 @@ firetray.IconLinux = { // prepare colors/alpha let colorMap = gdk.gdk_screen_get_system_colormap(gdk.gdk_screen_get_default()); let visual = gdk.gdk_colormap_get_visual(colorMap); - let visualDepth = gdk.gdk_visual_get_depth(visual); + let visualDepth = visual.contents.depth; LOG("colorMap="+colorMap+" visual="+visual+" visualDepth="+visualDepth); let fore = new gdk.GdkColor; fore.pixel = fore.red = fore.green = fore.blue = 0; diff --git a/src/modules/gdk.jsm b/src/modules/gdk.jsm index 35f3535..31583f3 100644 --- a/src/modules/gdk.jsm +++ b/src/modules/gdk.jsm @@ -59,7 +59,7 @@ function gdk_defines(lib) { this.GdkByteOrder = ctypes.int; // enum this.GdkVisualType = ctypes.int; // enum this.GdkVisual = ctypes.StructType("GdkVisual", [ - { "parent_instance": ctypes.void_t.ptr }, // gobject.GObject }, // FIXME !! + { "parent_instance": gobject.GObject }, { "type": this.GdkVisualType }, { "depth": gobject.gint }, { "byte": this.GdkByteOrder }, @@ -126,7 +126,6 @@ function gdk_defines(lib) { lib.lazy_bind("gdk_pixbuf_composite", ctypes.void_t, this.GdkPixbuf.ptr, this.GdkPixbuf.ptr, ctypes.int, ctypes.int, ctypes.int, ctypes.int, ctypes.double, ctypes.double, ctypes.double, ctypes.double, ctypes.int, ctypes.int); lib.lazy_bind("gdk_screen_get_system_colormap", this.GdkColormap.ptr, this.GdkScreen.ptr); lib.lazy_bind("gdk_colormap_get_visual", this.GdkVisual.ptr, this.GdkColormap.ptr); - lib.lazy_bind("gdk_visual_get_depth", gobject.gint, this.GdkVisual.ptr); lib.lazy_bind("gdk_color_parse", gobject.gboolean, gobject.gchar.ptr, this.GdkColor.ptr); lib.lazy_bind("gdk_colormap_alloc_color", gobject.gboolean, this.GdkColormap.ptr, this.GdkColor.ptr, gobject.gboolean, gobject.gboolean); lib.lazy_bind("gdk_pixmap_new", this.GdkPixmap.ptr, this.GdkDrawable.ptr, gobject.gint, gobject.gint, gobject.gint); diff --git a/src/modules/gobject.jsm b/src/modules/gobject.jsm index 6eb25a4..53fe463 100644 --- a/src/modules/gobject.jsm +++ b/src/modules/gobject.jsm @@ -50,7 +50,7 @@ Cu.import("resource://gre/modules/ctypes.jsm"); Cu.import("resource://firetray/ctypes-utils.jsm"); function gobject_defines(lib) { - this.GObject = ctypes.StructType("GObject"); + this.gpointer = ctypes.voidptr_t; this.gulong = ctypes.unsigned_long; this.guint = ctypes.unsigned_int; @@ -61,12 +61,28 @@ function gobject_defines(lib) { this.guchar = ctypes.unsigned_char; this.gboolean = this.gint; this.gfloat = ctypes.float; + this.gsize = ctypes.unsigned_long; this.GCallback = ctypes.voidptr_t; this.GClosureNotify = this.gpointer; this.GConnectFlags = this.guint; this.GFunc = ctypes.void_t.ptr; this.GList = ctypes.StructType("GList"); + this.GType = this.gsize; + this.GData = ctypes.StructType("GData"); + this._GTypeClass = ctypes.StructType("_GTypeClass", [ + {g_type: this.GType}]); + this._GTypeInstance = ctypes.StructType("_GTypeInstance", [ + {g_class: this._GTypeClass.ptr}]); + /* "All the fields in the GObject structure are private to the GObject + * implementation and should never be accessed directly." but we need to tell + * something about it to access GdkVisual fields */ + this.GObject = ctypes.StructType("GObject", [ + { g_type_instance: this._GTypeInstance }, + { ref_count: this.guint }, + { qdata: this.GData.ptr }, + ]); + /* NOTE: if we needed more/different args, we'd need to implement another FunctionType */ this.GCallback_t = ctypes.FunctionType(