From df850fa3947f1f911160503ad48eee182f9c262c Mon Sep 17 00:00:00 2001 From: Oleksii Samorukov Date: Wed, 15 Jan 2020 17:40:23 +0100 Subject: [PATCH] Return FALSE on gimp_osx_focus_window to avoid endless loop (cherry picked from commit 3e78c674d81ef0e64dba0a579c625b76004129f7) --- app/tests.c | 7 ++++--- libgimp/gimpui.c | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/tests.c b/app/tests.c index f3329f0878..e71bcbee63 100644 --- a/app/tests.c +++ b/app/tests.c @@ -97,10 +97,11 @@ gimp_init_icon_theme_for_testing (void) } #ifdef GDK_WINDOWING_QUARTZ -static void -gimp_osx_focus_window (void) +static gboolean +gimp_osx_focus_window (gpointer user_data) { [NSApp activateIgnoringOtherApps:YES]; + return FALSE; } #endif @@ -142,7 +143,7 @@ gimp_init_for_gui_testing_internal (gboolean show_gui, gimp_initialize (gimp, gimp_status_func_dummy); gimp_restore (gimp, gimp_status_func_dummy, NULL); #ifdef GDK_WINDOWING_QUARTZ - g_idle_add ((GSourceFunc) gimp_osx_focus_window, NULL); + g_idle_add (gimp_osx_focus_window, NULL); #endif return gimp; diff --git a/libgimp/gimpui.c b/libgimp/gimpui.c index b41a9d88ef..04c316a6a1 100644 --- a/libgimp/gimpui.c +++ b/libgimp/gimpui.c @@ -81,7 +81,7 @@ static void gimp_ui_draw_pixbuf_layout (GtkStyle *style, gint y, PangoLayout *layout); #ifdef GDK_WINDOWING_QUARTZ -static void gimp_osx_focus_window (void); +static gboolean gimp_osx_focus_window (gpointer); #endif static gboolean gimp_ui_initialized = FALSE; @@ -184,7 +184,7 @@ gimp_ui_init (const gchar *prog_name, gimp_dialogs_show_help_button (gimp_show_help_button ()); #ifdef GDK_WINDOWING_QUARTZ - g_idle_add ((GSourceFunc) gimp_osx_focus_window, NULL); + g_idle_add (gimp_osx_focus_window, NULL); #endif gimp_ui_fix_pixbuf_style (); @@ -496,9 +496,10 @@ gimp_ui_draw_pixbuf_layout (GtkStyle *style, } #ifdef GDK_WINDOWING_QUARTZ -static void -gimp_osx_focus_window (void) +static gboolean +gimp_osx_focus_window (gpointer user_data) { [NSApp activateIgnoringOtherApps:YES]; + return FALSE; } #endif