Fix plugin focus issues on osx

GTK/OSX does not automatically assign focus to the new windows (upstream 
issue), so activateIgnoringOtherApps is called. However, if it is called 
before gtk initialized it may cause number of focus issues.
This commit is contained in:
Oleksii Samorukov
2018-10-18 09:26:05 +02:00
parent ee05ada0c4
commit 3adf4a4861

View File

@ -80,7 +80,9 @@ static void gimp_ui_draw_pixbuf_layout (GtkStyle *style,
gint x,
gint y,
PangoLayout *layout);
#ifdef GDK_WINDOWING_QUARTZ
static void gimp_osx_focus_window (void);
#endif
static gboolean gimp_ui_initialized = FALSE;
@ -182,7 +184,7 @@ gimp_ui_init (const gchar *prog_name,
gimp_dialogs_show_help_button (gimp_show_help_button ());
#ifdef GDK_WINDOWING_QUARTZ
[NSApp activateIgnoringOtherApps:YES];
g_idle_add ((GSourceFunc) gimp_osx_focus_window, NULL);
#endif
gimp_ui_fix_pixbuf_style ();
@ -492,3 +494,11 @@ gimp_ui_draw_pixbuf_layout (GtkStyle *style,
if (area)
gdk_gc_set_clip_rectangle (gc, NULL);
}
#ifdef GDK_WINDOWING_QUARTZ
static void
gimp_osx_focus_window (void)
{
[NSApp activateIgnoringOtherApps:YES];
}
#endif