[gimp] Bug 761330: Gimp Drop Shadow window always opens...



commit f44c77b4a21264d25e6a95d94e11db639c092d84
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Wed Feb 10 17:14:00 2016 +0100

    Bug 761330: Gimp Drop Shadow window always opens...
    
    ...behind main window on windows
    
    Windows requires that the process with the
    foreground window explicitely allows long
    lasting background processes showing their
    windows as foreground/focused

 app/plug-in/gimppluginmanager-call.c     |   13 +++++++++++++
 plug-ins/script-fu/script-fu-interface.c |   11 +++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c
index 5d8d646..c528df1 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -22,6 +22,10 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gegl.h>
 
+#ifdef G_OS_WIN32
+#include <windows.h>
+#endif
+
 #include "libgimpbase/gimpbase.h"
 #include "libgimpbase/gimpprotocol.h"
 #include "libgimpbase/gimpwire.h"
@@ -49,6 +53,14 @@
 #include "gimp-intl.h"
 
 
+static void
+gimp_allow_set_foreground_window (GimpPlugIn *plug_in)
+{
+#ifdef G_OS_WIN32
+  AllowSetForegroundWindow (GetProcessId (plug_in->pid));
+#endif
+}
+
 /*  public functions  */
 
 void
@@ -330,6 +342,7 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager      *manager,
 
           return return_vals;
         }
+      gimp_allow_set_foreground_window (plug_in);
 
       g_free (proc_run.params);
 
diff --git a/plug-ins/script-fu/script-fu-interface.c b/plug-ins/script-fu/script-fu-interface.c
index 6e5bcd7..5457851 100644
--- a/plug-ins/script-fu/script-fu-interface.c
+++ b/plug-ins/script-fu/script-fu-interface.c
@@ -24,6 +24,8 @@
 
 #ifdef GDK_WINDOWING_QUARTZ
 #import <Cocoa/Cocoa.h>
+#elif defined (G_OS_WIN32)
+#include <windows.h>
 #endif
 
 #include "tinyscheme/scheme-private.h"
@@ -584,11 +586,20 @@ script_fu_interface (SFScript  *script,
   gtk_box_pack_start (GTK_BOX (vbox2), sf_interface->progress_label,
                       FALSE, FALSE, 0);
   gtk_widget_show (sf_interface->progress_label);
+#ifdef G_OS_WIN32
+    {
+      HWND foreground = GetForegroundWindow ();
+#endif
 
   gtk_widget_show (dialog);
 
   gtk_main ();
 
+#ifdef G_OS_WIN32
+      if (! GetForegroundWindow ())
+        SetForegroundWindow (foreground);
+    }
+#endif
   return sf_status;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]