--- libgimpwidgets/gimpdialog.c.orig	2012-03-12 20:18:09.000000000 +0100
+++ libgimpwidgets/gimpdialog.c	2012-10-06 23:01:11.000000000 +0200
@@ -28,6 +28,9 @@
 #include "gimpdialog.h"
 #include "gimphelpui.h"
 
+#ifdef GDK_WINDOWING_QUARTZ
+#import <Foundation/Foundation.h>
+#endif
 
 /**
  * SECTION: gimpdialog
@@ -465,6 +468,11 @@
 
   gimp_dialog_add_buttons_valist (GIMP_DIALOG (dialog), args);
 
+#ifdef GDK_WINDOWING_QUARTZ
+  gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_UTILITY);
+  gtk_window_set_position (GTK_WINDOW (dialog),GTK_WIN_POS_CENTER);
+#endif
+  
   return dialog;
 }
 
@@ -606,6 +614,32 @@
   ri->destroyed = TRUE;
 }
 
+#ifdef GDK_WINDOWING_QUARTZ 
+void
+gimp_dialog_activate_focus (void)
+{
+  /* plugin dialog pop up behind the main windows
+   * use a simple apple script to set them to front 
+   * and give them the focus
+   * setting dialog type-hint to UTILITY isn't actually needed, although it
+   * will make plugin dialogs act more like modal dialogs.
+   */
+  
+  NSAppleScript *script;
+  NSString *text;
+  gchar *plugin_name;
+  
+  plugin_name = g_get_prgname ();
+  text = [[NSString alloc] initWithFormat: @"tell application \"System Events\" to set frontmost of process \"%s\" to true", plugin_name];
+  script = [[NSAppleScript alloc] initWithSource: text];
+  [script executeAndReturnError: nil];
+
+  [script release];
+  [text release];
+  g_free (plugin_name);
+}
+#endif
+
 /**
  * gimp_dialog_run:
  * @dialog: a #GimpDialog
@@ -643,6 +677,10 @@
                                        G_CALLBACK (run_destroy_handler),
                                        &ri);
 
+#ifdef GDK_WINDOWING_QUARTZ
+  gimp_dialog_activate_focus ();
+#endif
+  
   ri.loop = g_main_loop_new (NULL, FALSE);
 
   GDK_THREADS_LEAVE ();
--- libgimpwidgets/gimpdialog.h.orig	2012-03-12 20:18:09.000000000 +0100
+++ libgimpwidgets/gimpdialog.h	2012-09-10 23:52:06.000000000 +0200
@@ -89,6 +89,9 @@
 /*  for internal use only!  */
 void        gimp_dialogs_show_help_button  (gboolean        show);
 
+#ifdef GDK_WINDOWING_QUARTZ
+void        gimp_dialog_activate_focus     (void);
+#endif
 
 G_END_DECLS
 
--- libgimpwidgets/Makefile.am.orig	2012-05-08 08:05:46.000000000 +0200
+++ libgimpwidgets/Makefile.am	2012-10-14 23:07:42.000000000 +0200
@@ -13,6 +13,11 @@
 libm = -lm
 endif
 
+if PLATFORM_OSX
+xobjective_c = "-xobjective-c"
+framework_cocoa = -framework Cocoa
+endif
+
 if OS_WIN32
 gimpwidgets_def = gimpwidgets.def
 libgimpwidgets_export_symbols = -export-symbols gimpwidgets.def
@@ -55,7 +60,8 @@
 INCLUDES = \
 	-I$(top_srcdir)	\
 	$(GTK_CFLAGS)	\
-	-I$(includedir)
+	-I$(includedir) \
+  $(xobjective_c)
 
 lib_LTLIBRARIES = libgimpwidgets-2.0.la
 
@@ -255,7 +261,8 @@
 libgimpwidgets_2_0_la_LDFLAGS = \
 	-version-info $(LT_VERSION_INFO)\
 	$(no_undefined) 		\
-	$(libgimpwidgets_export_symbols)
+	$(libgimpwidgets_export_symbols) \
+  $(framework_cocoa)
 
 libgimpwidgets_2_0_la_LIBADD = \
 	$(libgimpcolor)		\
--- plug-ins/script-fu/script-fu-interface.c.orig	2012-03-12 20:18:11.000000000 +0100
+++ plug-ins/script-fu/script-fu-interface.c	2012-09-11 23:46:37.000000000 +0200
@@ -583,6 +583,10 @@
 
   gtk_widget_show (dialog);
 
+#ifdef GDK_WINDOWING_QUARTZ
+  gimp_dialog_activate_focus ();
+#endif
+  
   gtk_main ();
 
   return sf_status;
