? app/dialogs/about-dialog-old.c
? app/dialogs/layer-attributes-dialog.c
Index: app/core/gimp-gui.c
===================================================================
RCS file: /cvs/gnome/gimp/app/core/gimp-gui.c,v
retrieving revision 1.7
diff -u -p -r1.7 gimp-gui.c
--- app/core/gimp-gui.c	24 Mar 2005 16:08:01 -0000	1.7
+++ app/core/gimp-gui.c	5 Sep 2005 18:07:45 -0000
@@ -50,6 +50,7 @@ gimp_gui_init (Gimp *gimp)
   gimp->gui.get_theme_dir       = NULL;
   gimp->gui.display_get_by_id   = NULL;
   gimp->gui.display_get_id      = NULL;
+  gimp->gui.display_get_window  = NULL;
   gimp->gui.display_create      = NULL;
   gimp->gui.display_delete      = NULL;
   gimp->gui.displays_reconnect  = NULL;
@@ -231,6 +232,19 @@ gimp_get_display_ID (Gimp       *gimp,
 
   if (gimp->gui.display_get_id)
     return gimp->gui.display_get_id (display);
+
+  return -1;
+}
+
+guint32
+gimp_get_display_window (Gimp       *gimp,
+                         GimpObject *display)
+{
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
+  g_return_val_if_fail (GIMP_IS_OBJECT (display), -1);
+
+  if (gimp->gui.display_get_window)
+    return gimp->gui.display_get_window (display);
 
   return -1;
 }
Index: app/core/gimp-gui.h
===================================================================
RCS file: /cvs/gnome/gimp/app/core/gimp-gui.h,v
retrieving revision 1.5
diff -u -p -r1.5 gimp-gui.h
--- app/core/gimp-gui.h	24 Mar 2005 16:08:01 -0000	1.5
+++ app/core/gimp-gui.h	5 Sep 2005 18:07:45 -0000
@@ -46,6 +46,7 @@ struct _GimpGui
   GimpObject   * (* display_get_by_id)   (Gimp          *gimp,
                                           gint           ID);
   gint           (* display_get_id)      (GimpObject    *display);
+  guint32        (* display_get_window)  (GimpObject    *display);
   GimpObject   * (* display_create)      (GimpImage     *gimage,
                                           GimpUnit       unit,
                                           gdouble        scale);
@@ -99,6 +100,8 @@ void           gimp_threads_leave       
 GimpObject   * gimp_get_display_by_ID    (Gimp               *gimp,
                                           gint                ID);
 gint           gimp_get_display_ID       (Gimp               *gimp,
+                                          GimpObject         *display);
+guint32        gimp_get_display_window   (Gimp               *gimp,
                                           GimpObject         *display);
 GimpObject   * gimp_create_display       (Gimp               *gimp,
                                           GimpImage          *gimage,
Index: app/display/gimpdisplay.c
===================================================================
RCS file: /cvs/gnome/gimp/app/display/gimpdisplay.c,v
retrieving revision 1.263
diff -u -p -r1.263 gimpdisplay.c
--- app/display/gimpdisplay.c	11 May 2005 20:41:51 -0000	1.263
+++ app/display/gimpdisplay.c	5 Sep 2005 18:07:45 -0000
@@ -20,6 +20,14 @@
 
 #include <gtk/gtk.h>
 
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
+
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
 #include "display-types.h"
 #include "tools/tools-types.h"
 
@@ -436,6 +444,36 @@ gimp_display_get_ID (GimpDisplay *gdisp)
   g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), -1);
 
   return gdisp->ID;
+}
+
+GdkNativeWindow
+gimp_display_get_window (GimpDisplay *display)
+{
+  GtkWidget *shell;
+
+#ifdef GDK_NATIVE_WINDOW_POINTER
+  g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
+#else
+  g_return_val_if_fail (GIMP_IS_DISPLAY (display), -1);
+#endif
+
+  shell = display->shell;
+
+#ifdef GDK_WINDOWING_WIN32
+  if (shell && GTK_WIDGET_REALIZED (shell))
+    return GDK_WINDOW_HWND (shell->window);
+#endif
+
+#ifdef GDK_WINDOWING_X11
+  if (shell && GTK_WIDGET_REALIZED (shell))
+    return GDK_WINDOW_XID (shell->window);
+#endif
+
+#ifdef GDK_NATIVE_WINDOW_POINTER
+  return NULL;
+#else
+  return -1;
+#endif
 }
 
 GimpDisplay *
Index: app/display/gimpdisplay.h
===================================================================
RCS file: /cvs/gnome/gimp/app/display/gimpdisplay.h,v
retrieving revision 1.90
diff -u -p -r1.90 gimpdisplay.h
--- app/display/gimpdisplay.h	13 Jul 2004 16:36:29 -0000	1.90
+++ app/display/gimpdisplay.h	5 Sep 2005 18:07:45 -0000
@@ -54,31 +54,32 @@ struct _GimpDisplayClass
 };
 
 
-GType         gimp_display_get_type    (void) G_GNUC_CONST;
+GType             gimp_display_get_type    (void) G_GNUC_CONST;
 
-GimpDisplay * gimp_display_new         (GimpImage       *gimage,
-                                        GimpUnit         unit,
-                                        gdouble          scale,
-                                        GimpMenuFactory *menu_factory,
-                                        GimpUIManager   *popup_manager);
-void          gimp_display_delete      (GimpDisplay     *gdisp);
+GimpDisplay *     gimp_display_new         (GimpImage       *gimage,
+                                            GimpUnit         unit,
+                                            gdouble          scale,
+                                            GimpMenuFactory *menu_factory,
+                                            GimpUIManager   *popup_manager);
+void              gimp_display_delete      (GimpDisplay     *gdisp);
 
-gint          gimp_display_get_ID      (GimpDisplay     *gdisp);
-GimpDisplay * gimp_display_get_by_ID   (Gimp            *gimp,
-                                        gint             ID);
+gint              gimp_display_get_ID      (GimpDisplay     *gdisp);
+GdkNativeWindow   gimp_display_get_window  (GimpDisplay     *gdisp);
+GimpDisplay *     gimp_display_get_by_ID   (Gimp            *gimp,
+                                            gint             ID);
 
-void          gimp_display_reconnect   (GimpDisplay     *gdisp,
-                                        GimpImage       *gimage);
+void              gimp_display_reconnect   (GimpDisplay     *gdisp,
+                                            GimpImage       *gimage);
 
-void          gimp_display_update_area (GimpDisplay     *gdisp,
-                                        gboolean         now,
-                                        gint             x,
-                                        gint             y,
-                                        gint             w,
-                                        gint             h);
+void              gimp_display_update_area (GimpDisplay     *gdisp,
+                                            gboolean         now,
+                                            gint             x,
+                                            gint             y,
+                                            gint             w,
+                                            gint             h);
 
-void          gimp_display_flush       (GimpDisplay     *gdisp);
-void          gimp_display_flush_now   (GimpDisplay     *gdisp);
+void              gimp_display_flush       (GimpDisplay     *gdisp);
+void              gimp_display_flush_now   (GimpDisplay     *gdisp);
 
 
 #endif /*  __GIMP_DISPLAY_H__  */
Index: app/gui/gui-vtable.c
===================================================================
RCS file: /cvs/gnome/gimp/app/gui/gui-vtable.c,v
retrieving revision 1.36
diff -u -p -r1.36 gui-vtable.c
--- app/gui/gui-vtable.c	12 Apr 2005 23:46:10 -0000	1.36
+++ app/gui/gui-vtable.c	5 Sep 2005 18:07:45 -0000
@@ -93,6 +93,7 @@ static const gchar  * gui_get_theme_dir 
 static GimpObject   * gui_display_get_by_ID    (Gimp          *gimp,
                                                 gint           ID);
 static gint           gui_display_get_ID       (GimpObject    *display);
+static guint32        gui_display_get_window   (GimpObject    *display);
 static GimpObject   * gui_display_create       (GimpImage     *gimage,
                                                 GimpUnit       unit,
                                                 gdouble        scale);
@@ -152,6 +153,7 @@ gui_vtable_init (Gimp *gimp)
   gimp->gui.get_theme_dir       = gui_get_theme_dir;
   gimp->gui.display_get_by_id   = gui_display_get_by_ID;
   gimp->gui.display_get_id      = gui_display_get_ID;
+  gimp->gui.display_get_window  = gui_display_get_window;
   gimp->gui.display_create      = gui_display_create;
   gimp->gui.display_delete      = gui_display_delete;
   gimp->gui.displays_reconnect  = gui_displays_reconnect;
@@ -326,6 +328,19 @@ static gint
 gui_display_get_ID (GimpObject *display)
 {
   return gimp_display_get_ID (GIMP_DISPLAY (display));
+}
+
+static guint32
+gui_display_get_window (GimpObject *display)
+{
+#ifdef GDK_NATIVE_WINDOW_POINTER
+#ifdef __GNUC__
+#warning gui_display_get_window() unimplementable for the windowing system
+#endif
+  return -1;
+#else
+  return (guint32) gimp_display_get_window (GIMP_DISPLAY (display));
+#endif
 }
 
 static GimpObject *
Index: app/pdb/display_cmds.c
===================================================================
RCS file: /cvs/gnome/gimp/app/pdb/display_cmds.c,v
retrieving revision 1.36
diff -u -p -r1.36 display_cmds.c
--- app/pdb/display_cmds.c	5 Aug 2005 18:19:09 -0000	1.36
+++ app/pdb/display_cmds.c	5 Sep 2005 18:07:45 -0000
@@ -32,6 +32,7 @@
 
 static ProcRecord display_new_proc;
 static ProcRecord display_delete_proc;
+static ProcRecord display_get_window_proc;
 static ProcRecord displays_flush_proc;
 static ProcRecord displays_reconnect_proc;
 
@@ -40,6 +41,7 @@ register_display_procs (Gimp *gimp)
 {
   procedural_db_register (gimp, &display_new_proc);
   procedural_db_register (gimp, &display_delete_proc);
+  procedural_db_register (gimp, &display_get_window_proc);
   procedural_db_register (gimp, &displays_flush_proc);
   procedural_db_register (gimp, &displays_reconnect_proc);
 }
@@ -158,6 +160,68 @@ static ProcRecord display_delete_proc =
   0,
   NULL,
   { { display_delete_invoker } }
+};
+
+static Argument *
+display_get_window_invoker (Gimp         *gimp,
+                            GimpContext  *context,
+                            GimpProgress *progress,
+                            Argument     *args)
+{
+  gboolean success = TRUE;
+  Argument *return_args;
+  GimpObject *display;
+  gint32 window = 0;
+
+  display = gimp_get_display_by_ID (gimp, args[0].value.pdb_int);
+  if (! GIMP_IS_OBJECT (display))
+    success = FALSE;
+
+  if (success)
+    window = (gint32) gimp_get_display_window (gimp, display);
+
+  return_args = procedural_db_return_args (&display_get_window_proc, success);
+
+  if (success)
+    return_args[1].value.pdb_int = window;
+
+  return return_args;
+}
+
+static ProcArg display_get_window_inargs[] =
+{
+  {
+    GIMP_PDB_DISPLAY,
+    "display",
+    "The display to get the window handle from"
+  }
+};
+
+static ProcArg display_get_window_outargs[] =
+{
+  {
+    GIMP_PDB_INT32,
+    "window",
+    "The native window handle or -1"
+  }
+};
+
+static ProcRecord display_get_window_proc =
+{
+  "gimp-display-get-window",
+  "gimp-display-get-window",
+  "Get a handle to the native window for an image display.",
+  "This procedure returns a handle to the native window for a given image display. For example in the X backend of GDK, a native window handle is an Xlib XID. A value of -1 is returned for an invalid display or if this function is unimplemented for the windowing system that is being used.",
+  "Sven Neumann",
+  "Sven Neumann",
+  "2005",
+  NULL,
+  GIMP_INTERNAL,
+  1,
+  display_get_window_inargs,
+  1,
+  display_get_window_outargs,
+  { { display_get_window_invoker } }
 };
 
 static Argument *
Index: app/pdb/internal_procs.c
===================================================================
RCS file: /cvs/gnome/gimp/app/pdb/internal_procs.c,v
retrieving revision 1.89
diff -u -p -r1.89 internal_procs.c
--- app/pdb/internal_procs.c	2 Sep 2005 22:50:06 -0000	1.89
+++ app/pdb/internal_procs.c	5 Sep 2005 18:07:45 -0000
@@ -75,7 +75,7 @@ void register_undo_procs               (
 void register_unit_procs               (Gimp *gimp);
 void register_vectors_procs            (Gimp *gimp);
 
-/* 471 procedures registered total */
+/* 472 procedures registered total */
 
 void
 internal_procs_init (Gimp               *gimp,
@@ -102,82 +102,82 @@ internal_procs_init (Gimp               
   (* status_callback) (NULL, _("Context"), 0.121);
   register_context_procs (gimp);
 
-  (* status_callback) (NULL, _("Convert"), 0.168);
+  (* status_callback) (NULL, _("Convert"), 0.167);
   register_convert_procs (gimp);
 
   (* status_callback) (NULL, _("Display procedures"), 0.174);
   register_display_procs (gimp);
 
-  (* status_callback) (NULL, _("Drawable procedures"), 0.183);
+  (* status_callback) (NULL, _("Drawable procedures"), 0.184);
   register_drawable_procs (gimp);
 
-  (* status_callback) (NULL, _("Transformation procedures"), 0.257);
+  (* status_callback) (NULL, _("Transformation procedures"), 0.258);
   register_drawable_transform_procs (gimp);
 
-  (* status_callback) (NULL, _("Edit procedures"), 0.291);
+  (* status_callback) (NULL, _("Edit procedures"), 0.292);
   register_edit_procs (gimp);
 
-  (* status_callback) (NULL, _("File Operations"), 0.323);
+  (* status_callback) (NULL, _("File Operations"), 0.324);
   register_fileops_procs (gimp);
 
-  (* status_callback) (NULL, _("Floating selections"), 0.344);
+  (* status_callback) (NULL, _("Floating selections"), 0.345);
   register_floating_sel_procs (gimp);
 
-  (* status_callback) (NULL, _("Font UI"), 0.357);
+  (* status_callback) (NULL, _("Font UI"), 0.358);
   register_font_select_procs (gimp);
 
-  (* status_callback) (NULL, _("Fonts"), 0.363);
+  (* status_callback) (NULL, _("Fonts"), 0.364);
   register_fonts_procs (gimp);
 
-  (* status_callback) (NULL, _("Gimprc procedures"), 0.367);
+  (* status_callback) (NULL, _("Gimprc procedures"), 0.369);
   register_gimprc_procs (gimp);
 
-  (* status_callback) (NULL, _("Gradient"), 0.382);
+  (* status_callback) (NULL, _("Gradient"), 0.383);
   register_gradient_procs (gimp);
 
-  (* status_callback) (NULL, _("Gradient UI"), 0.446);
+  (* status_callback) (NULL, _("Gradient UI"), 0.447);
   register_gradient_select_procs (gimp);
 
-  (* status_callback) (NULL, _("Gradients"), 0.452);
+  (* status_callback) (NULL, _("Gradients"), 0.453);
   register_gradients_procs (gimp);
 
-  (* status_callback) (NULL, _("Guide procedures"), 0.463);
+  (* status_callback) (NULL, _("Guide procedures"), 0.464);
   register_guides_procs (gimp);
 
-  (* status_callback) (NULL, _("Help procedures"), 0.476);
+  (* status_callback) (NULL, _("Help procedures"), 0.477);
   register_help_procs (gimp);
 
-  (* status_callback) (NULL, _("Image"), 0.478);
+  (* status_callback) (NULL, _("Image"), 0.479);
   register_image_procs (gimp);
 
-  (* status_callback) (NULL, _("Layer"), 0.611);
+  (* status_callback) (NULL, _("Layer"), 0.612);
   register_layer_procs (gimp);
 
   (* status_callback) (NULL, _("Message procedures"), 0.669);
   register_message_procs (gimp);
 
-  (* status_callback) (NULL, _("Miscellaneous"), 0.675);
+  (* status_callback) (NULL, _("Miscellaneous"), 0.676);
   register_misc_procs (gimp);
 
   (* status_callback) (NULL, _("Paint Tool procedures"), 0.682);
   register_paint_tools_procs (gimp);
 
-  (* status_callback) (NULL, _("Palette"), 0.713);
+  (* status_callback) (NULL, _("Palette"), 0.714);
   register_palette_procs (gimp);
 
-  (* status_callback) (NULL, _("Palette UI"), 0.743);
+  (* status_callback) (NULL, _("Palette UI"), 0.744);
   register_palette_select_procs (gimp);
 
-  (* status_callback) (NULL, _("Palettes"), 0.749);
+  (* status_callback) (NULL, _("Palettes"), 0.75);
   register_palettes_procs (gimp);
 
   (* status_callback) (NULL, _("Parasite procedures"), 0.758);
   register_parasite_procs (gimp);
 
-  (* status_callback) (NULL, _("Paths"), 0.783);
+  (* status_callback) (NULL, _("Paths"), 0.784);
   register_paths_procs (gimp);
 
-  (* status_callback) (NULL, _("Pattern"), 0.817);
+  (* status_callback) (NULL, _("Pattern"), 0.818);
   register_pattern_procs (gimp);
 
   (* status_callback) (NULL, _("Pattern UI"), 0.822);
@@ -189,10 +189,10 @@ internal_procs_init (Gimp               
   (* status_callback) (NULL, _("Plug-in"), 0.837);
   register_plug_in_procs (gimp);
 
-  (* status_callback) (NULL, _("Procedural database"), 0.849);
+  (* status_callback) (NULL, _("Procedural database"), 0.85);
   register_procedural_db_procs (gimp);
 
-  (* status_callback) (NULL, _("Progress"), 0.868);
+  (* status_callback) (NULL, _("Progress"), 0.869);
   register_progress_procs (gimp);
 
   (* status_callback) (NULL, _("Image mask"), 0.883);
@@ -204,7 +204,7 @@ internal_procs_init (Gimp               
   (* status_callback) (NULL, _("Text procedures"), 0.93);
   register_text_tool_procs (gimp);
 
-  (* status_callback) (NULL, _("Transform Tool procedures"), 0.938);
+  (* status_callback) (NULL, _("Transform Tool procedures"), 0.939);
   register_transform_tools_procs (gimp);
 
   (* status_callback) (NULL, _("Undo"), 0.951);
Index: libgimp/gimpdisplay_pdb.c
===================================================================
RCS file: /cvs/gnome/gimp/libgimp/gimpdisplay_pdb.c,v
retrieving revision 1.14
diff -u -p -r1.14 gimpdisplay_pdb.c
--- libgimp/gimpdisplay_pdb.c	2 Aug 2005 22:52:19 -0000	1.14
+++ libgimp/gimpdisplay_pdb.c	5 Sep 2005 18:07:45 -0000
@@ -91,6 +91,42 @@ gimp_display_delete (gint32 display_ID)
 }
 
 /**
+ * gimp_display_get_window:
+ * @display_ID: The display to get the window handle from.
+ *
+ * Get a handle to the native window for an image display.
+ *
+ * This procedure returns a handle to the native window for a given
+ * image display. For example in the X backend of GDK, a native window
+ * handle is an Xlib XID. A value of -1 is returned for an invalid
+ * display or if this function is unimplemented for the windowing
+ * system that is being used.
+ *
+ * Returns: The native window handle or -1.
+ *
+ * Since: GIMP 2.4
+ */
+gint
+gimp_display_get_window (gint32 display_ID)
+{
+  GimpParam *return_vals;
+  gint nreturn_vals;
+  gint window = 0;
+
+  return_vals = gimp_run_procedure ("gimp-display-get-window",
+				    &nreturn_vals,
+				    GIMP_PDB_DISPLAY, display_ID,
+				    GIMP_PDB_END);
+
+  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+    window = return_vals[1].data.d_int32;
+
+  gimp_destroy_params (return_vals, nreturn_vals);
+
+  return window;
+}
+
+/**
  * gimp_displays_flush:
  *
  * Flush all internal changes to the user interface
Index: libgimp/gimpdisplay_pdb.h
===================================================================
RCS file: /cvs/gnome/gimp/libgimp/gimpdisplay_pdb.h,v
retrieving revision 1.7
diff -u -p -r1.7 gimpdisplay_pdb.h
--- libgimp/gimpdisplay_pdb.h	3 Jul 2003 00:47:07 -0000	1.7
+++ libgimp/gimpdisplay_pdb.h	5 Sep 2005 18:07:45 -0000
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
 
 gint32   gimp_display_new        (gint32 image_ID);
 gboolean gimp_display_delete     (gint32 display_ID);
+gint     gimp_display_get_window (gint32 display_ID);
 gboolean gimp_displays_flush     (void);
 gboolean gimp_displays_reconnect (gint32 old_image_ID,
 				  gint32 new_image_ID);
Index: libgimp/gimpui.c
===================================================================
RCS file: /cvs/gnome/gimp/libgimp/gimpui.c,v
retrieving revision 1.31
diff -u -p -r1.31 gimpui.c
--- libgimp/gimpui.c	20 Apr 2005 09:33:16 -0000	1.31
+++ libgimp/gimpui.c	5 Sep 2005 18:07:45 -0000
@@ -34,9 +34,14 @@
 
 /*  local function prototypes  */
 
-static void  gimp_ui_help_func   (const gchar *help_id,
-                                  gpointer     help_data);
-static void  gimp_ensure_modules (void);
+static void  gimp_ui_help_func              (const gchar *help_id,
+                                             gpointer     help_data);
+static void  gimp_ensure_modules            (void);
+static void  gimp_window_transient_realized (GtkWidget   *window,
+                                             GdkWindow   *parent);
+
+
+static gboolean gimp_ui_initialized = FALSE;
 
 
 /*  public functions  */
@@ -60,8 +65,6 @@ void
 gimp_ui_init (const gchar *prog_name,
 	      gboolean     preview)
 {
-  static gboolean initialized = FALSE;
-
   const gchar  *display_name;
   gint          argc;
   gchar       **argv;
@@ -70,7 +73,7 @@ gimp_ui_init (const gchar *prog_name,
 
   g_return_if_fail (prog_name != NULL);
 
-  if (initialized)
+  if (gimp_ui_initialized)
     return;
 
   display_name = gimp_display_name ();
@@ -116,7 +119,99 @@ gimp_ui_init (const gchar *prog_name,
 
   gimp_dialogs_show_help_button (gimp_show_help_button ());
 
-  initialized = TRUE;
+  gimp_ui_initialized = TRUE;
+}
+
+/**
+ * gimp_get_display_window:
+ *
+ * Returns the #GdkWindow of a display window. The purpose is to allow
+ * to make plug-in dialogs transient to the image display as explained
+ * with gdk_window_set_transient_for().
+ *
+ * You shouldn't have to call this function directly. Use
+ * gimp_window_set_transient_for_display() instead.
+ *
+ * Return value: A reference to a #GdkWindow or %NULL. You should
+ *               unref the window using g_object_unref() as soon as
+ *               you don't need it any longer.
+ *
+ * Since: GIMP 2.4
+ */
+GdkWindow *
+gimp_get_display_window (guint32 gdisp_ID)
+{
+  GdkNativeWindow  window;
+
+  g_return_val_if_fail (gimp_ui_initialized, NULL);
+  g_return_val_if_fail (gdisp_ID != -1, NULL);
+
+  window = gimp_display_get_window (gdisp_ID);
+
+  return gdk_window_foreign_new_for_display (gdk_display_get_default (),
+                                             window);
+}
+
+/**
+ * gimp_window_set_transient_for_display:
+ * @window:   a #GtkWindow that should become transient
+ * @gdisp_ID: display ID of the image window that should become the parent
+ *
+ * Indicates to the window manager that @window is a transient dialog
+ * associated with the GIMP image window that is identified by it's
+ * display ID.  See gdk_window_set_transient_for () for more information.
+ *
+ * Most of the time you will want to use the convenience function
+ * gimp_window_set_transient_for_default_display().
+ *
+ * Since: GIMP 2.4
+ */
+void
+gimp_window_set_transient_for_display (GtkWindow *window,
+                                       guint32    gdisp_ID)
+{
+  GdkWindow *display;
+
+  g_return_if_fail (gimp_ui_initialized);
+  g_return_if_fail (GTK_IS_WINDOW (window));
+
+  gtk_window_set_transient_for (window, NULL);
+
+  g_signal_handlers_disconnect_matched (window, G_SIGNAL_MATCH_FUNC,
+                                        0, 0, NULL,
+                                        gimp_window_transient_realized,
+                                        NULL);
+
+  display = gimp_get_display_window (gdisp_ID);
+  if (! display)
+    return;
+
+  if (GTK_WIDGET_REALIZED (window))
+    gdk_window_set_transient_for (GTK_WIDGET (window)->window, display);
+
+  g_signal_connect_object (window, "realize",
+                           G_CALLBACK (gimp_window_transient_realized),
+                           display, 0);
+  g_object_unref (window);
+}
+
+/**
+ * gimp_window_set_transient_for_default_display:
+ * @window:   a #GtkWindow that should become transient
+ *
+ * Indicates to the window manager that @window is a transient dialog
+ * associated with the GIMP image window that the plug-in has been
+ * started from. See also gimp_window_set_transient_for_display().
+ *
+ * Since: GIMP 2.4
+ */
+void
+gimp_window_set_transient_for_default_display (GtkWindow *window)
+{
+  g_return_if_fail (gimp_ui_initialized);
+  g_return_if_fail (GTK_IS_WINDOW (window));
+
+  gimp_window_set_transient_for_display (window, gimp_default_display ());
 }
 
 
@@ -147,4 +242,12 @@ gimp_ensure_modules (void)
       g_free (module_path);
       g_free (load_inhibit);
     }
+}
+
+static void
+gimp_window_transient_realized (GtkWidget *window,
+                                GdkWindow *parent)
+{
+  if (GTK_WIDGET_REALIZED (window))
+    gdk_window_set_transient_for (window->window, parent);
 }
Index: libgimp/gimpui.h
===================================================================
RCS file: /cvs/gnome/gimp/libgimp/gimpui.h,v
retrieving revision 1.31
diff -u -p -r1.31 gimpui.h
--- libgimp/gimpui.h	2 Aug 2005 16:38:02 -0000	1.31
+++ libgimp/gimpui.h	5 Sep 2005 18:07:45 -0000
@@ -49,8 +49,14 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-void gimp_ui_init (const gchar *prog_name,
-                   gboolean     preview);
+void        gimp_ui_init (const gchar *prog_name,
+                          gboolean     preview);
+
+GdkWindow * gimp_get_display_window                       (guint32    gdisp_ID);
+
+void        gimp_window_set_transient_for_display         (GtkWindow *window,
+                                                           guint32    gdisp_ID);
+void        gimp_window_set_transient_for_default_display (GtkWindow *window);
 
 
 G_END_DECLS
Index: plug-ins/common/gauss.c
===================================================================
RCS file: /cvs/gnome/gimp/plug-ins/common/gauss.c,v
retrieving revision 1.26
diff -u -p -r1.26 gauss.c
--- plug-ins/common/gauss.c	13 Aug 2005 22:52:41 -0000	1.26
+++ plug-ins/common/gauss.c	5 Sep 2005 18:07:45 -0000
@@ -477,6 +477,8 @@ gauss_dialog (gint32        image_ID,
                                            GTK_RESPONSE_CANCEL,
                                            -1);
 
+  gimp_window_set_transient_for_default_display (GTK_WINDOW (dialog));
+
   main_vbox = gtk_vbox_new (FALSE, 12);
   gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
   gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
Index: tools/pdbgen/pdb/display.pdb
===================================================================
RCS file: /cvs/gnome/gimp/tools/pdbgen/pdb/display.pdb,v
retrieving revision 1.25
diff -u -p -r1.25 display.pdb
--- tools/pdbgen/pdb/display.pdb	29 Nov 2004 16:59:53 -0000	1.25
+++ tools/pdbgen/pdb/display.pdb	5 Sep 2005 18:07:45 -0000
@@ -72,6 +72,34 @@ HELP
     %invoke = ( code => 'gimp_delete_display (gimp, display);' );
 }
 
+sub display_get_window {
+    $blurb = 'Get a handle to the native window for an image display.';
+
+    $help = <<'HELP';
+This procedure returns a handle to the native window for a given image
+display. For example in the X backend of GDK, a native window handle is
+an Xlib XID. A value of -1 is returned for an invalid display or if this
+function is unimplemented for the windowing system that is being used.
+HELP
+
+    $author = $copyright = 'Sven Neumann';
+    $date = '2005';
+    $since = '2.4';
+
+    @inargs = (
+	{ name => 'display', type => 'display',
+	  desc => 'The display to get the window handle from' }
+    );
+
+    @outargs = (
+        { name => 'window', type => 'int32',
+          desc => 'The native window handle or -1',
+	  init => 1, return_fail => -1 }
+    );
+
+    %invoke = ( code => 'window = (gint32) gimp_get_display_window (gimp, display);' );
+}
+
 sub displays_flush {
     $blurb = 'Flush all internal changes to the user interface';
 
@@ -129,7 +157,8 @@ CODE
 
 @headers = qw("core/gimp.h");
 
-@procs = qw(display_new display_delete displays_flush displays_reconnect);
+@procs = qw(display_new display_delete display_get_window
+            displays_flush displays_reconnect);
 %exports = (app => [@procs], lib => [@procs]);
 
 $desc = 'Display procedures';
