From cb0ed210287eb3f4b81376a0cbe72661af0f7756 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Thu, 18 Oct 2001 19:58:22 +0000 Subject: Fix the WM problems related to the folder selection dialog being out-of-proc. Now it can be set to be a transient window correctly, and fakes its WindowGroup hint appropriately. svn path=/trunk/; revision=13765 --- shell/e-shell.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 6e97a6ff01..510fbe14a3 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -26,8 +26,13 @@ #endif #include + #include #include +#include + +#include + #include #include #include @@ -44,6 +49,8 @@ #include "Evolution.h" +#include "e-util/e-dialog-utils.h" + #include "e-activity-handler.h" #include "e-component-registry.h" #include "e-corba-shortcuts.h" @@ -372,6 +379,7 @@ corba_listener_destroy_notify (void *data) static void impl_Shell_selectUserFolder (PortableServer_Servant servant, + const CORBA_long_long parent_xid, const GNOME_Evolution_FolderSelectionListener listener, const CORBA_char *title, const CORBA_char *default_folder, @@ -407,6 +415,7 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, allowed_type_names, default_type); + listener_duplicate = CORBA_Object_duplicate (listener, ev); gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener", listener_duplicate, corba_listener_destroy_notify); @@ -416,7 +425,43 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled", GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_cb), shell); - gtk_widget_show (folder_selection_dialog); + if (parent_xid == 0) { + gtk_widget_show (folder_selection_dialog); + } else { + XClassHint class_hints; + XWMHints *parent_wm_hints; + int format; + + /* Set the WM class and the WindowGroup hint to be the same as + the foreign parent window's. This way smartass window + managers like Sawfish don't get confused. */ + + e_set_dialog_parent_from_xid (GTK_WINDOW (folder_selection_dialog), parent_xid); + + XGetClassHint (GDK_DISPLAY (), (Window) parent_xid, &class_hints); + + gtk_window_set_wmclass (GTK_WINDOW (folder_selection_dialog), + class_hints.res_name, class_hints.res_class); + + gtk_widget_show (folder_selection_dialog); + + while (folder_selection_dialog->window == NULL) + gtk_main_iteration (); + + parent_wm_hints = XGetWMHints (GDK_DISPLAY (), (Window) parent_xid); + + if (parent_wm_hints->flags & WindowGroupHint) { + XWMHints *wm_hints; + + wm_hints = XAllocWMHints (); + wm_hints->flags = WindowGroupHint; + wm_hints->window_group = parent_wm_hints->window_group; + XSetWMHints (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (folder_selection_dialog->window), wm_hints); + XFree (wm_hints); + } + + XFree (parent_wm_hints); + } } static GNOME_Evolution_Storage -- cgit v1.2.3