From f86a3ac7942a5bd2d0d48d6254ca5420e902d67f Mon Sep 17 00:00:00 2001 From: foudfou Date: Mon, 23 Apr 2012 00:32:01 +0200 Subject: [PATCH] use Gtk gtk_widget_show/hide instead of Moz BaseWindow.visibility. This ensures Thunderbird to be shown, when launched from the command line, while already running. NOTE: gdk_window_show/hide also works, but we'd lose the ability to resize and move the windows before showing it when restoring. --- src/modules/ctypes/linux/gtk.jsm | 2 +- src/modules/linux/FiretrayWindow.jsm | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/ctypes/linux/gtk.jsm b/src/modules/ctypes/linux/gtk.jsm index 2ae8d3b..5dfd936 100644 --- a/src/modules/ctypes/linux/gtk.jsm +++ b/src/modules/ctypes/linux/gtk.jsm @@ -93,7 +93,6 @@ function gtk_defines(lib) { lib.lazy_bind("gtk_image_menu_item_set_image", ctypes.void_t, this.GtkImageMenuItem.ptr, this.GtkWidget.ptr); lib.lazy_bind("gtk_menu_shell_append", ctypes.void_t, this.GtkMenuShell.ptr, this.GtkWidget.ptr); lib.lazy_bind("gtk_menu_shell_prepend", ctypes.void_t, this.GtkMenuShell.ptr, this.GtkWidget.ptr); - lib.lazy_bind("gtk_widget_show_all", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_menu_popup", ctypes.void_t, this.GtkMenu.ptr, this.GtkWidget.ptr, this.GtkWidget.ptr, this.GtkMenuPositionFunc_t, gobject.gpointer, gobject.guint, gobject.guint); lib.lazy_bind("gtk_status_icon_position_menu", ctypes.void_t, this.GtkMenu.ptr, gobject.gint.ptr, gobject.gint.ptr, gobject.gboolean.ptr, gobject.gpointer); lib.lazy_bind("gtk_separator_menu_item_new", this.GtkWidget.ptr); @@ -113,6 +112,7 @@ function gtk_defines(lib) { lib.lazy_bind("gtk_widget_hide_on_delete", gobject.gboolean, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_hide", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_show", ctypes.void_t, this.GtkWidget.ptr); + lib.lazy_bind("gtk_widget_show_all", ctypes.void_t, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_get_events", gobject.gint, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_get_events", gobject.gint, this.GtkWidget.ptr); lib.lazy_bind("gtk_widget_add_events", ctypes.void_t, this.GtkWidget.ptr, gobject.gint); diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm index aed2507..9229851 100644 --- a/src/modules/linux/FiretrayWindow.jsm +++ b/src/modules/linux/FiretrayWindow.jsm @@ -320,7 +320,12 @@ firetray.Window = { }, setVisibility: function(xid, visibility) { - firetray.Handler.windows[xid].baseWin.visibility = visibility; + let gtkWidget = ctypes.cast(firetray.Handler.gtkWindows.get(xid), gtk.GtkWidget.ptr); + if (visibility) + gtk.gtk_widget_show_all(gtkWidget); + else + gtk.gtk_widget_hide(gtkWidget); + firetray.Handler.windows[xid].visibility = visibility; firetray.Handler.visibleWindowsCount = visibility ? firetray.Handler.visibleWindowsCount + 1 :