From 3adf4a4861ba0641e64caaf6fd80a794da7687a9 Mon Sep 17 00:00:00 2001 From: Oleksii Samorukov Date: Thu, 18 Oct 2018 09:26:05 +0200 Subject: [PATCH] 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. --- libgimp/gimpui.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libgimp/gimpui.c b/libgimp/gimpui.c index 54e04ee357..11bccd2e01 100644 --- a/libgimp/gimpui.c +++ b/libgimp/gimpui.c @@ -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