diff --git a/src/modules/ctypes/linux/gdk.jsm b/src/modules/ctypes/linux/gdk.jsm index 13f31bc..073df19 100644 --- a/src/modules/ctypes/linux/gdk.jsm +++ b/src/modules/ctypes/linux/gdk.jsm @@ -248,6 +248,10 @@ function gdk_defines(lib) { ctypes.default_abi, this.GdkFilterReturn, [this.GdkXEvent.ptr, this.GdkEvent.ptr, gobject.gpointer]).ptr; + lib.lazy_bind("gdk_flush", ctypes.void_t); + lib.lazy_bind("gdk_error_trap_push", ctypes.void_t); + lib.lazy_bind("gdk_error_trap_pop", gobject.gint); + lib.lazy_bind("gdk_x11_drawable_get_xid", x11.XID, this.GdkDrawable.ptr); lib.lazy_bind("gdk_window_new", this.GdkWindow.ptr, this.GdkWindow.ptr, this.GdkWindowAttributes.ptr, gobject.gint); lib.lazy_bind("gdk_window_destroy", ctypes.void_t, this.GdkWindow.ptr); @@ -298,6 +302,7 @@ function gdk_defines(lib) { lib.lazy_bind("gdk_window_get_user_data", ctypes.void_t, this.GdkWindow.ptr, gobject.gpointer.ptr); lib.lazy_bind("gdk_atom_intern", this.GdkAtom, gobject.gchar.ptr, gobject.gboolean); lib.lazy_bind("gdk_property_change", ctypes.void_t, this.GdkWindow.ptr, this.GdkAtom, this.GdkAtom, gobject.gint, this.GdkPropMode, gobject.guchar.ptr, gobject.gint); + lib.lazy_bind("gdk_window_get_effective_toplevel", this.GdkWindow.ptr, this.GdkWindow.ptr); lib.lazy_bind("gdk_display_get_n_screens", gobject.gint, this.GdkDisplay.ptr); lib.lazy_bind("gdk_display_get_screen", this.GdkScreen.ptr, this.GdkDisplay.ptr, gobject.gint); diff --git a/src/modules/ctypes/linux/x11.jsm b/src/modules/ctypes/linux/x11.jsm index 6033e47..ab25c99 100644 --- a/src/modules/ctypes/linux/x11.jsm +++ b/src/modules/ctypes/linux/x11.jsm @@ -120,6 +120,7 @@ function x11_defines(lib) { this.StructureNotifyMask = 1<<17 this.SubstructureNotifyMask = 1<<19; this.SubstructureRedirectMask = 1<<20; + this.FocusChangeMask = 1<<21 this.PropertyChangeMask = 1<<22 this.Bool = ctypes.int; diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm index c4493c1..a892fb7 100644 --- a/src/modules/linux/FiretrayWindow.jsm +++ b/src/modules/linux/FiretrayWindow.jsm @@ -162,6 +162,7 @@ firetray.Window = { getGdkWindowFromNativeHandle: function(nativeHandle) { let gdkw = new gdk.GdkWindow.ptr(ctypes.UInt64(nativeHandle)); // a new pointer to the GdkWindow + gdkw = gdk.gdk_window_get_effective_toplevel(gdkw); log.debug("gdkw="+gdkw+" *gdkw="+this.addrPointedByInHex(gdkw)); return gdkw; }, @@ -171,9 +172,6 @@ firetray.Window = { gdk.gdk_window_get_user_data(gdkWin, gptr.address()); log.debug("gptr="+gptr+" *gptr="+this.addrPointedByInHex(gptr)); let gtkw = ctypes.cast(gptr, gtk.GtkWindow.ptr); - let gtkw_voidp = ctypes.cast(gtkw, ctypes.void_t.ptr); - let gtkwid_top = gtk.gtk_widget_get_toplevel(ctypes.cast(gtkw, gtk.GtkWidget.ptr)); - gtkw = ctypes.cast(gtkwid_top, gtk.GtkWindow.ptr); log.debug("gtkw="+gtkw+" *gtkw="+this.addrPointedByInHex(gtkw)); return gtkw; }, @@ -499,11 +497,11 @@ firetray.Window = { let status = x11.XGetWindowAttributes(x11.current.Display, xid, xWindowAttributes.address()); log.debug("xWindowAttributes: "+xWindowAttributes); let xEventMask = xWindowAttributes.your_event_mask; - let xEventMaskNeeded = x11.VisibilityChangeMask|x11.StructureNotifyMask|x11.PropertyChangeMask; + let xEventMaskNeeded = x11.VisibilityChangeMask|x11.StructureNotifyMask| + x11.FocusChangeMask|x11.PropertyChangeMask; log.debug("xEventMask="+xEventMask+" xEventMaskNeeded="+xEventMaskNeeded); if ((xEventMask & xEventMaskNeeded) !== xEventMaskNeeded) { - log.warn("missing mandatory event-masks"); - // could try to subscribe here with XChangeWindowAttributes() + log.error("missing mandatory event-masks"); // change with gdk_window_set_events() } }, @@ -540,6 +538,7 @@ firetray.Window = { return gdk.GDK_FILTER_CONTINUE; } + }; // firetray.Window