Bug 677776 - filter popup windows get hidden behind main image window

On OSX, call [NSApp activateIgnoringOtherApps] when a plug-in dialog
is shown, so the plug-in process becomes the active app, and the
dialog gets focussed.

In order to avoid doing this in GimpDialog (which is also used in
the core), do it in gimp_ui_init() which all interactive plug-ins
call, and when gimp_temp_proc_run() is called interactively, to
catch repeated activation of an already running plug-in.

Also, set GimpDialog's initial position to GTK_WIN_POS_CENTER,
or they will pop up in the top left corner.

Inspired by patches from Simone Karin Lehmann and Daniel Sabo.
This commit is contained in:
Michael Natterer 2012-11-07 23:44:35 +01:00
parent 6a33951aa6
commit 0b56aa0d13
4 changed files with 39 additions and 8 deletions

View file

@ -11,6 +11,11 @@ if PLATFORM_WIN32
no_undefined = -no-undefined
endif
if PLATFORM_OSX
xobjective_c = "-xobjective-c"
framework_cocoa = -framework Cocoa
endif
if OS_WIN32
gimp_def = gimp.def
gimpui_def = gimpui.def
@ -62,10 +67,11 @@ AM_CPPFLAGS = \
-DGIMP_COMPILATION
INCLUDES = \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir)
-I$(top_srcdir) \
$(GTK_CFLAGS) \
$(GEGL_CFLAGS) \
-I$(includedir) \
$(xobjective_c)
lib_LTLIBRARIES = libgimp-@GIMP_API_VERSION@.la libgimpui-@GIMP_API_VERSION@.la
@ -364,7 +370,8 @@ gimpinclude_HEADERS = \
libgimp_@GIMP_API_VERSION@_la_LDFLAGS = \
-version-info $(LT_VERSION_INFO) \
$(no_undefined) \
$(libgimp_export_symbols)
$(libgimp_export_symbols) \
$(framework_cocoa)
libgimp_@GIMP_API_VERSION@_la_LIBADD = \
$(libgimpconfig) \
@ -384,7 +391,8 @@ libgimp_@GIMP_API_VERSION@_la_DEPENDENCIES = \
libgimpui_@GIMP_API_VERSION@_la_LDFLAGS = \
-version-info $(LT_VERSION_INFO) \
$(no_undefined) \
$(libgimpui_export_symbols)
$(libgimpui_export_symbols) \
$(framework_cocoa)
libgimpui_@GIMP_API_VERSION@_la_LIBADD = \
$(libgimp) \

View file

@ -49,7 +49,7 @@
#define WAIT_ANY -1
#endif
#include <glib-object.h>
#include <gtk/gtk.h> /* need GDK_WINDOWING_FOO defines */
#ifndef G_OS_WIN32
#include "libgimpbase/gimpsignal.h"
@ -82,6 +82,10 @@
#endif /* USE_POSIX_SHM */
#ifdef GDK_WINDOWING_QUARTZ
#include <Cocoa/Cocoa.h>
#endif
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
# define STRICT
# define _WIN32_WINNT 0x0601
@ -2002,7 +2006,6 @@ gimp_proc_run (GPProcRun *proc_run)
}
}
static void
gimp_temp_proc_run (GPProcRun *proc_run)
{
@ -2014,6 +2017,14 @@ gimp_temp_proc_run (GPProcRun *proc_run)
GimpParam *return_vals;
gint n_return_vals;
#ifdef GDK_WINDOWING_QUARTZ
if (proc_run->params &&
proc_run->params[0].data.d_int32 == GIMP_RUN_INTERACTIVE)
{
[NSApp activateIgnoringOtherApps:YES];
}
#endif
(* run_proc) (proc_run->name,
proc_run->nparams,
(GimpParam *) proc_run->params,

View file

@ -28,6 +28,10 @@
#include <gdk/gdkx.h>
#endif
#ifdef GDK_WINDOWING_QUARTZ
#include <Cocoa/Cocoa.h>
#endif
#include "gimp.h"
#include "gimpui.h"
@ -143,6 +147,10 @@ gimp_ui_init (const gchar *prog_name,
gimp_dialogs_show_help_button (gimp_show_help_button ());
#ifdef GDK_WINDOWING_QUARTZ
[NSApp activateIgnoringOtherApps:YES];
#endif
gimp_ui_initialized = TRUE;
}

View file

@ -149,6 +149,10 @@ gimp_dialog_class_init (GimpDialogClass *klass)
static void
gimp_dialog_init (GimpDialog *dialog)
{
#ifdef GDK_WINDOWING_QUARTZ
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
#endif
g_signal_connect (dialog, "response",
G_CALLBACK (gimp_dialog_response),
NULL);