[gimp/gimp-2-10] tests: OSX - activate GIMP window when tests are running
- From: Alex Samorukov <asamorukov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] tests: OSX - activate GIMP window when tests are running
- Date: Fri, 23 Nov 2018 22:19:24 +0000 (UTC)
commit 63e86da6f3b696d448415c0c8c9bea83bdd68845
Author: Oleksii Samorukov <samm os2 kiev ua>
Date: Fri Nov 23 23:15:25 2018 +0100
tests: OSX - activate GIMP window when tests are running
If window is not focused gimp_test_utils_synthesize_key_event would
fail.
app/Makefile.am | 7 +++++++
app/tests.c | 15 +++++++++++++++
2 files changed, 22 insertions(+)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index 86aec105f2..46dd220bd0 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -1,5 +1,11 @@
## Process this file with automake to produce Makefile.in
+if PLATFORM_OSX
+xobjective_c = "-xobjective-c"
+xobjective_cxx = "-xobjective-c++"
+xnone = "-xnone"
+endif
+
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
@@ -125,6 +131,7 @@ AM_CPPFLAGS = \
$(LCMS_CFLAGS) \
$(GEXIV2_CFLAGS) \
$(psapi_cflags) \
+ $(xobjective_c) \
-I$(includedir) \
-I$(builddir)/gui
diff --git a/app/tests.c b/app/tests.c
index ef29951043..f3329f0878 100644
--- a/app/tests.c
+++ b/app/tests.c
@@ -42,6 +42,10 @@
#include "gimp-log.h"
#include "tests.h"
+#ifdef GDK_WINDOWING_QUARTZ
+#include <Cocoa/Cocoa.h>
+#endif
+
static void
gimp_status_func_dummy (const gchar *text1,
@@ -92,6 +96,14 @@ gimp_init_icon_theme_for_testing (void)
return;
}
+#ifdef GDK_WINDOWING_QUARTZ
+static void
+gimp_osx_focus_window (void)
+{
+ [NSApp activateIgnoringOtherApps:YES];
+}
+#endif
+
static Gimp *
gimp_init_for_gui_testing_internal (gboolean show_gui,
GFile *gimprc)
@@ -129,6 +141,9 @@ gimp_init_for_gui_testing_internal (gboolean show_gui,
gimp_init_icon_theme_for_testing ();
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);
+#endif
return gimp;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]