[gimp/gimp-2-8] Bug 761330: Gimp Drop Shadow window always opens...



commit 4bea7134fd11ceaffd759887eb5a820f493e9af5
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
    
    (cherry picked from commit f44c77b4a21264d25e6a95d94e11db639c092d84)

 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 99882cc..4fd4b87 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -21,6 +21,10 @@
 
 #include <glib-object.h>
 
+#ifdef G_OS_WIN32
+#include <windows.h>
+#endif
+
 #include "libgimpbase/gimpbase.h"
 #include "libgimpbase/gimpprotocol.h"
 #include "libgimpbase/gimpwire.h"
@@ -52,6 +56,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 89d2acb..c27486c 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]