--- libgimpwidgets/gimpdialog.c.orig	2012-03-12 20:18:09.000000000 +0100
+++ libgimpwidgets/gimpdialog.c	2012-09-02 20:13:49.000000000 +0200
@@ -28,6 +28,9 @@
 #include "gimpdialog.h"
 #include "gimphelpui.h"
 
+#ifdef GDK_WINDOWING_QUARTZ
+#include <Carbon/Carbon.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;
 }
 
@@ -643,6 +651,44 @@
                                        G_CALLBACK (run_destroy_handler),
                                        &ri);
 
+#ifdef GDK_WINDOWING_QUARTZ
+/* plugin dialog pop up beind the main windows
+ * use OS X system task switcher to bring them to front and
+ * give them the focus
+ * setting type-hint to UTILITY isn't neede any longr, although it 
+ * will make plugin dialogs act mor like modal dialogs.
+ */
+  
+  /* Compile and run a small AppleScript */
+  ComponentInstance theComponent;
+  AEDesc scriptTextDesc;
+  OSStatus err;
+  OSAID scriptID, resultID;
+  
+  
+  const char *text = "tell application \"System Events\" to keystroke tab using {shift, command down}";
+  
+  /* set up locals to a known state */
+  theComponent = NULL;
+  AECreateDesc(typeNull, NULL, 0, &scriptTextDesc);
+  scriptID = kOSANullScript;
+  resultID = kOSANullScript;
+  
+  /* open the scripting component */
+  theComponent = OpenDefaultComponent (kOSAComponentType, typeAppleScript);
+  if (theComponent) {
+    /* put the script text into an aedesc */
+    AECreateDesc (typeChar, text, strlen (text), &scriptTextDesc);
+    
+    /* compile the script */
+    OSACompile (theComponent, &scriptTextDesc, kOSAModeNull, &scriptID);
+  }
+  
+  /* runs the compiled applescript */
+  OSAExecute (theComponent, scriptID, kOSANullScript, kOSAModeNull, &resultID);
+
+#endif
+  
   ri.loop = g_main_loop_new (NULL, FALSE);
 
   GDK_THREADS_LEAVE ();
