From 7dbb9fee3dab94c87cf215a8b903c7a1538209a2 Mon Sep 17 00:00:00 2001
From: Oleksii Samorukov <samm@os2.kiev.ua>
Date: Wed, 24 Oct 2018 10:37:36 +0200
Subject: [PATCH] Fix compilation on Mac 10.6 and 10.7 (#2112)

---
 app/display/gimpimagewindow.c          |  9 ++++-----
 app/widgets/gimpwidgets-utils.c        |  2 +-
 libgimpwidgets/gimppickbutton-quartz.c | 15 +++++++++++++++
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 8fd598d91f..9defe164fc 100644
--- app/display/gimpimagewindow.c
+++ app/display/gimpimagewindow.c
@@ -94,6 +94,10 @@
 /* Whether the window's maximized or not */
 #define GIMP_IMAGE_WINDOW_MAXIMIZED        "maximized"
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+#define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8)
+#endif
+
 
 enum
 {
@@ -633,12 +637,7 @@ gimp_image_window_map (GtkWidget *widget)
    * as soon as GTK+ has proper support for this, we will migrate to the
    * new-style full screen mode.
    */
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
   ns_window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
-#else
-  /* Hard code the define ... */
-  ns_window.collectionBehavior |= 1 << 8;
-#endif
 #endif /* !GDK_WINDOWING_QUARTZ */
 }
 
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 53725d10e5..529a453fef 100644
--- app/widgets/gimpwidgets-utils.c
+++ app/widgets/gimpwidgets-utils.c
@@ -34,7 +34,7 @@
 #endif
 
 #ifdef PLATFORM_OSX
-#include <CoreGraphics/CoreGraphics.h>
+#include <ApplicationServices/ApplicationServices.h>
 #endif
 
 #include "libgimpbase/gimpbase.h"
diff --git a/libgimpwidgets/gimppickbutton-quartz.c b/libgimpwidgets/gimppickbutton-quartz.c
index 0e676fe94a..3da42b59a4 100644
--- libgimpwidgets/gimppickbutton-quartz.c
+++ libgimpwidgets/gimppickbutton-quartz.c
@@ -34,6 +34,21 @@
 #include <ApplicationServices/ApplicationServices.h>
 #endif
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+@interface NSWindow (GIMPExt)
+- (NSRect) convertRectToScreen: (NSRect)aRect;
+@end
+@implementation NSWindow (GIMPExt)
+- (NSRect) convertRectToScreen: (NSRect)aRect
+{
+  NSRect result = aRect;
+  NSPoint origin = result.origin;
+  result.origin = [self convertBaseToScreen:origin];
+  return result;
+}
+@end
+#endif
+
 
 @interface GimpPickWindowController : NSObject
 {
-- 
2.18.1