diff --git a/src/macfont.h b/src/macfont.h index 3289990..abb37cd 100644 --- a/src/macfont.h +++ b/src/macfont.h @@ -45,12 +45,12 @@ struct mac_glyph_layout CGGlyph glyph_id; }; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 +#if !defined (MAC_OS_X_VERSION_10_8) enum { kCTFontTraitItalic = kCTFontItalicTrait, kCTFontTraitBold = kCTFontBoldTrait, kCTFontTraitMonoSpace = kCTFontMonoSpaceTrait, -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 && defined (MAC_OS_X_VERSION_10_7) kCTFontTraitColorGlyphs = kCTFontColorGlyphsTrait #else kCTFontTraitColorGlyphs = (1 << 13) diff --git a/src/macfont.m b/src/macfont.m index 19145f9..91ad520 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -2875,7 +2875,7 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no @selector(backingScaleFactor)]) #endif CGContextSetLineWidth (context, synthetic_bold_factor * font_size - * [[FRAME_NS_VIEW(f) window] backingScaleFactor]); + * [(EmacsWindow *) [FRAME_NS_VIEW(f) window] backingScaleFactor]); #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 else #endif diff --git a/src/nsfns.m b/src/nsfns.m index e19e4e2..3f20c8e 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1592,7 +1592,7 @@ Frames are listed from topmost (first) to bottommost (last). */) } #ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 +#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 && defined (MAC_OS_X_VERSION_10_9) #define MODAL_OK_RESPONSE NSModalResponseOK #endif #endif diff --git a/src/nsterm.h b/src/nsterm.h index a60f94e..7969a90 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -38,6 +38,35 @@ typedef CGFloat EmacsCGFloat; typedef float EmacsCGFloat; #endif +/* macOS 10.7 introduces some new constants, enums and methods. + Forward declare them when building on macOS 10.6. */ +#if !defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +#define NSFullScreenWindowMask (1 << 14) +#define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) +#define NSApplicationPresentationFullScreen (1 << 10) +#define NSApplicationPresentationAutoHideToolbar (1 << 11) +#define NSAppKitVersionNumber10_7 1138 + +// As in https://chromium.googlesource.com/chromium/blink/+/master/Source/platform/mac/NSScrollerImpDetails.h. +enum { + NSScrollerStyleLegacy = 0, + NSScrollerStyleOverlay = 1 +}; +typedef NSInteger NSScrollerStyle; + +@interface NSScroller(NSObject) ++ (CGFloat)scrollerWidthForControlSize:(NSControlSize)controlSize scrollerStyle:(NSScrollerStyle)scrollerStyle; +@end + +void CTFontDrawGlyphs(CTFontRef font, const CGGlyph *glyphs, const CGPoint *positions, size_t count, CGContextRef context) __attribute__((weak_import)); +#endif + +#if !defined (MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 +extern CFArrayRef CTFontCopyDefaultCascadeListForLanguages(CTFontRef font, CFArrayRef languagePrefList) __attribute__((weak_import)); +#define kCTFontUIFontUser 0 + +#endif + /* ========================================================================== Trace support @@ -470,6 +499,10 @@ typedef id instancetype; { NSPoint grabOffset; } +#if !defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 +- (NSRect)convertRectToScreen:(NSRect)rect; +@property(readonly) CGFloat backingScaleFactor; +#endif @end @@ -1251,14 +1284,6 @@ extern char gnustep_base_version[]; /* version tracking */ ? (min) : (((x)>(max)) ? (max) : (x))) #define SCREENMAXBOUND(x) (IN_BOUND (-SCREENMAX, x, SCREENMAX)) -/* macOS 10.7 introduces some new constants. */ -#if !defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 -#define NSWindowStyleMaskFullScreen (1 << 14) -#define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) -#define NSApplicationPresentationFullScreen (1 << 10) -#define NSApplicationPresentationAutoHideToolbar (1 << 11) -#endif - /* macOS 10.12 deprecates a bunch of constants. */ #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12) #define NSEventModifierFlagCommand NSCommandKeyMask diff --git a/src/nsterm.m b/src/nsterm.m index 1eaf94a..e0a977b 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6342,7 +6342,7 @@ - (NSRect)firstRectForCharacterRange: (NSRange)theRange { #endif rect.origin = pt; - rect = [[self window] convertRectToScreen: rect]; + rect = [(EmacsWindow *) [self window] convertRectToScreen: rect]; #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 } else