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
This commit is contained in:
Massimo Valentini 2016-02-10 17:14:00 +01:00
parent 18316c41a5
commit f44c77b4a2
2 changed files with 24 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}