diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index 31af32b6e5..b5768f40ca 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -155,9 +155,7 @@ public: outputLatency (0), bitDepth (32), callback (nullptr), - #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 audioProcID (0), - #endif deviceID (id), started (false), sampleRate (0), @@ -625,11 +623,7 @@ public: if (deviceID != 0) { - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - if (OK (AudioDeviceAddIOProc (deviceID, audioIOProc, this))) - #else if (OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, this, &audioProcID))) - #endif { if (OK (AudioDeviceStart (deviceID, audioIOProc))) { @@ -637,12 +631,8 @@ public: } else { - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - OK (AudioDeviceRemoveIOProc (deviceID, audioIOProc)); - #else OK (AudioDeviceDestroyIOProcID (deviceID, audioProcID)); audioProcID = 0; - #endif } } } @@ -669,13 +659,8 @@ public: && ! leaveInterruptRunning) { OK (AudioDeviceStop (deviceID, audioIOProc)); - - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - OK (AudioDeviceRemoveIOProc (deviceID, audioIOProc)); - #else OK (AudioDeviceDestroyIOProcID (deviceID, audioProcID)); audioProcID = 0; - #endif started = false; @@ -793,9 +778,7 @@ public: Array sampleRates; Array bufferSizes; AudioIODeviceCallback* callback; - #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 AudioDeviceIOProcID audioProcID; - #endif private: CriticalSection callbackLock; diff --git a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm index ce09dfd380..4f471cc131 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -240,17 +240,9 @@ public: return noErr; case kAudioUnitProperty_CocoaUI: - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - // (On 10.4, there's a random obj-c dispatching crash when trying to load a cocoa UI) - if (SystemStats::getOperatingSystemType() >= SystemStats::MacOSX_10_5) - #endif - { - outDataSize = sizeof (AudioUnitCocoaViewInfo); - outWritable = true; - return noErr; - } - - break; + outDataSize = sizeof (AudioUnitCocoaViewInfo); + outWritable = true; + return noErr; #if JucePlugin_ProducesMidiOutput case kAudioUnitProperty_MIDIOutputCallbackInfo: @@ -304,10 +296,6 @@ public: return noErr; case kAudioUnitProperty_CocoaUI: - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - // (On 10.4, there's a random obj-c dispatching crash when trying to load a cocoa UI) - if (SystemStats::getOperatingSystemType() >= SystemStats::MacOSX_10_5) - #endif { JUCE_AUTORELEASEPOOL { @@ -324,8 +312,6 @@ public: return noErr; } - break; - #if JucePlugin_ProducesMidiOutput case kAudioUnitProperty_MIDIOutputCallbackInfo: { diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index 9464344cca..7c56b11be8 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -972,12 +972,7 @@ private: kAudioUnitScope_Global, 0, &info, sizeof (info)); } - AUEventListenerCreate (eventListenerCallback, this, - #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 - CFRunLoopGetMain(), - #else - nullptr, - #endif + AUEventListenerCreate (eventListenerCallback, this, CFRunLoopGetMain(), kCFRunLoopDefaultMode, 0, 0, &eventListenerRef); for (int i = 0; i < parameters.size(); ++i) diff --git a/modules/juce_core/memory/juce_Atomic.h b/modules/juce_core/memory/juce_Atomic.h index bbf9d67b99..0f388a87bf 100644 --- a/modules/juce_core/memory/juce_Atomic.h +++ b/modules/juce_core/memory/juce_Atomic.h @@ -190,18 +190,12 @@ private: #if JUCE_MAC && (JUCE_PPC || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)) #define JUCE_ATOMICS_MAC_LEGACY 1 // Older OSX builds using gcc4.1 or earlier - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - #define JUCE_MAC_ATOMICS_VOLATILE - #else - #define JUCE_MAC_ATOMICS_VOLATILE volatile - #endif - #if JUCE_PPC // None of these atomics are available for PPC or for iOS 3.1 or earlier!! - template static Type OSAtomicAdd64Barrier (Type b, JUCE_MAC_ATOMICS_VOLATILE Type* a) noexcept { jassertfalse; return *a += b; } - template static Type OSAtomicIncrement64Barrier (JUCE_MAC_ATOMICS_VOLATILE Type* a) noexcept { jassertfalse; return ++*a; } - template static Type OSAtomicDecrement64Barrier (JUCE_MAC_ATOMICS_VOLATILE Type* a) noexcept { jassertfalse; return --*a; } - template static bool OSAtomicCompareAndSwap64Barrier (Type old, Type newValue, JUCE_MAC_ATOMICS_VOLATILE Type* value) noexcept + template static Type OSAtomicAdd64Barrier (Type b, volatile Type* a) noexcept { jassertfalse; return *a += b; } + template static Type OSAtomicIncrement64Barrier (volatile Type* a) noexcept { jassertfalse; return ++*a; } + template static Type OSAtomicDecrement64Barrier (volatile Type* a) noexcept { jassertfalse; return --*a; } + template static bool OSAtomicCompareAndSwap64Barrier (Type old, Type newValue, volatile Type* value) noexcept { jassertfalse; if (old == *value) { *value = newValue; return true; } return false; } #define JUCE_64BIT_ATOMICS_UNAVAILABLE 1 #endif @@ -340,8 +334,8 @@ template inline Type Atomic::get() const noexcept { #if JUCE_ATOMICS_MAC_LEGACY - return sizeof (Type) == 4 ? castFrom32Bit ((int32) OSAtomicAdd32Barrier ((int32_t) 0, (JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value)) - : castFrom64Bit ((int64) OSAtomicAdd64Barrier ((int64_t) 0, (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value)); + return sizeof (Type) == 4 ? castFrom32Bit ((int32) OSAtomicAdd32Barrier ((int32_t) 0, (volatile int32_t*) &value)) + : castFrom64Bit ((int64) OSAtomicAdd64Barrier ((int64_t) 0, (volatile int64_t*) &value)); #elif JUCE_ATOMICS_WINDOWS return WindowsInterlockedHelpers::add (const_cast (&value), (Type) 0); #elif JUCE_ATOMICS_GCC @@ -366,8 +360,8 @@ template inline Type Atomic::operator+= (const Type amountToAdd) noexcept { #if JUCE_ATOMICS_MAC_LEGACY - return sizeof (Type) == 4 ? (Type) OSAtomicAdd32Barrier ((int32_t) castTo32Bit (amountToAdd), (JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value) - : (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value); + return sizeof (Type) == 4 ? (Type) OSAtomicAdd32Barrier ((int32_t) castTo32Bit (amountToAdd), (volatile int32_t*) &value) + : (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (volatile int64_t*) &value); #elif JUCE_ATOMICS_WINDOWS return WindowsInterlockedHelpers::add (&value, amountToAdd); #elif JUCE_ATOMICS_GCC @@ -385,8 +379,8 @@ template inline Type Atomic::operator++() noexcept { #if JUCE_ATOMICS_MAC_LEGACY - return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32Barrier ((JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value) - : (Type) OSAtomicIncrement64Barrier ((JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value); + return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32Barrier ((volatile int32_t*) &value) + : (Type) OSAtomicIncrement64Barrier ((volatile int64_t*) &value); #elif JUCE_ATOMICS_WINDOWS return WindowsInterlockedHelpers::inc (&value); #elif JUCE_ATOMICS_GCC @@ -399,8 +393,8 @@ template inline Type Atomic::operator--() noexcept { #if JUCE_ATOMICS_MAC_LEGACY - return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32Barrier ((JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value) - : (Type) OSAtomicDecrement64Barrier ((JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value); + return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32Barrier ((volatile int32_t*) &value) + : (Type) OSAtomicDecrement64Barrier ((volatile int64_t*) &value); #elif JUCE_ATOMICS_WINDOWS return WindowsInterlockedHelpers::dec (&value); #elif JUCE_ATOMICS_GCC @@ -413,8 +407,8 @@ template inline bool Atomic::compareAndSetBool (const Type newValue, const Type valueToCompare) noexcept { #if JUCE_ATOMICS_MAC_LEGACY - return sizeof (Type) == 4 ? OSAtomicCompareAndSwap32Barrier ((int32_t) castTo32Bit (valueToCompare), (int32_t) castTo32Bit (newValue), (JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value) - : OSAtomicCompareAndSwap64Barrier ((int64_t) castTo64Bit (valueToCompare), (int64_t) castTo64Bit (newValue), (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value); + return sizeof (Type) == 4 ? OSAtomicCompareAndSwap32Barrier ((int32_t) castTo32Bit (valueToCompare), (int32_t) castTo32Bit (newValue), (volatile int32_t*) &value) + : OSAtomicCompareAndSwap64Barrier ((int64_t) castTo64Bit (valueToCompare), (int64_t) castTo64Bit (newValue), (volatile int64_t*) &value); #elif JUCE_ATOMICS_WINDOWS return compareAndSetValue (newValue, valueToCompare) == valueToCompare; #elif JUCE_ATOMICS_GCC diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index 3eaa223766..5817bb6252 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -277,12 +277,7 @@ String File::getVersion() const //============================================================================== static NSString* getFileLink (const String& path) { - #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) return [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (path) error: nil]; - #else - // (the cast here avoids a deprecation warning) - return [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (path)]; - #endif } bool File::isSymbolicLink() const @@ -462,13 +457,7 @@ OSType File::getMacOSType() const { JUCE_AUTORELEASEPOOL { - #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (getFullPathName()) error: nil]; - #else - // (the cast here avoids a deprecation warning) - NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (getFullPathName()) traverseLink: NO]; - #endif - return [fileDict fileHFSTypeCode]; } } diff --git a/modules/juce_core/native/juce_mac_SystemStats.mm b/modules/juce_core/native/juce_mac_SystemStats.mm index c1b437194d..18d8909c15 100644 --- a/modules/juce_core/native/juce_mac_SystemStats.mm +++ b/modules/juce_core/native/juce_mac_SystemStats.mm @@ -84,11 +84,7 @@ void CPUInformation::initialise() noexcept hasAVX = (c & (1u << 28)) != 0; #endif - #if JUCE_IOS || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) numCpus = (int) [[NSProcessInfo processInfo] activeProcessorCount]; - #else - numCpus = (int) MPProcessors(); - #endif } #if JUCE_MAC diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index dc123f5b1e..2bb5a6a108 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -888,7 +888,7 @@ void Thread::killThread() void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name) { - #if JUCE_IOS || (JUCE_MAC && defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) + #if JUCE_IOS || JUCE_MAC JUCE_AUTORELEASEPOOL { [[NSThread currentThread] setName: juceStringToNS (name)]; diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index 3ae770d7ce..aae410a079 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -131,12 +131,12 @@ #define JUCE_INTEL 1 #endif - #if JUCE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 - #error "Building for OSX 10.3 is no longer supported!" + #if JUCE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + #error "Building for OSX 10.4 is no longer supported!" #endif - #if JUCE_MAC && ! defined (MAC_OS_X_VERSION_10_5) - #error "To build with 10.4 compatibility, use a 10.5 or 10.6 SDK and set the deployment target to 10.4" + #if JUCE_MAC && ! defined (MAC_OS_X_VERSION_10_6) + #error "To build with 10.5 compatibility, use a later SDK and set the deployment target to 10.5" #endif #endif diff --git a/modules/juce_events/native/juce_mac_MessageManager.mm b/modules/juce_events/native/juce_mac_MessageManager.mm index e1f6d87abc..63eda5985d 100644 --- a/modules/juce_events/native/juce_mac_MessageManager.mm +++ b/modules/juce_events/native/juce_mac_MessageManager.mm @@ -330,14 +330,6 @@ void MessageManager::doPlatformSpecificInitialisation() { if (appDelegate == nil) appDelegate = new AppDelegate(); - - #if ! (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) - // This launches a dummy thread, which forces Cocoa to initialise NSThreads correctly (needed prior to 10.5) - if (! [NSThread isMultiThreaded]) - [NSThread detachNewThreadSelector: @selector (dummyMethod) - toTarget: appDelegate->delegate - withObject: nil]; - #endif } void MessageManager::doPlatformSpecificShutdown() diff --git a/modules/juce_events/native/juce_osx_MessageQueue.h b/modules/juce_events/native/juce_osx_MessageQueue.h index 4b36564074..7c92d5e0d5 100644 --- a/modules/juce_events/native/juce_osx_MessageQueue.h +++ b/modules/juce_events/native/juce_osx_MessageQueue.h @@ -32,10 +32,10 @@ class MessageQueue public: MessageQueue() { - #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 && ! JUCE_IOS - runLoop = CFRunLoopGetMain(); - #else + #if JUCE_IOS runLoop = CFRunLoopGetCurrent(); + #else + runLoop = CFRunLoopGetMain(); #endif CFRunLoopSourceContext sourceContext; diff --git a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm index a6f98741ad..4c6c5ad8dd 100644 --- a/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm +++ b/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm @@ -405,19 +405,7 @@ void CoreGraphicsContext::fillCGRect (const CGRect& cgRect, const bool replaceEx { if (replaceExistingContents) { - #if JUCE_IOS CGContextSetBlendMode (context, kCGBlendModeCopy); - #elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 - CGContextClearRect (context, cgRect); - #else - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - if (CGContextDrawLinearGradient == 0) // (just a way of checking whether we're running in 10.5 or later) - CGContextClearRect (context, cgRect); - else - #endif - CGContextSetBlendMode (context, kCGBlendModeCopy); - #endif - fillCGRect (cgRect, false); CGContextSetBlendMode (context, kCGBlendModeNormal); } @@ -500,15 +488,15 @@ void CoreGraphicsContext::drawImage (const Image& sourceImage, const AffineTrans #if JUCE_IOS CGContextDrawTiledImage (context, imageRect, image); #else - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 // There's a bug in CGContextDrawTiledImage that makes it incredibly slow // if it's doing a transformation - it's quicker to just draw lots of images manually if (&CGContextDrawTiledImage != 0 && transform.isOnlyTranslation()) - CGContextDrawTiledImage (context, imageRect, image); - else - #endif { - // Fallback to manually doing a tiled fill on 10.4 + CGContextDrawTiledImage (context, imageRect, image); + } + else + { + // Fallback to manually doing a tiled fill CGRect clip = CGRectIntegral (CGContextGetClipBoundingBox (context)); int x = 0, y = 0; diff --git a/modules/juce_graphics/native/juce_mac_Fonts.mm b/modules/juce_graphics/native/juce_mac_Fonts.mm index 895d0ee764..157f40990d 100644 --- a/modules/juce_graphics/native/juce_mac_Fonts.mm +++ b/modules/juce_graphics/native/juce_mac_Fonts.mm @@ -22,8 +22,7 @@ ============================================================================== */ -#if (! defined (JUCE_CORETEXT_AVAILABLE)) \ - && (JUCE_IOS || (JUCE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4)) +#ifndef JUCE_CORETEXT_AVAILABLE #define JUCE_CORETEXT_AVAILABLE 1 #endif @@ -635,7 +634,7 @@ public: return x; } - void getGlyphPositions (const String& text, Array & resultGlyphs, Array & xOffsets) override + void getGlyphPositions (const String& text, Array& resultGlyphs, Array& xOffsets) override { xOffsets.add (0); @@ -815,29 +814,6 @@ StringArray Font::findAllTypefaceStyles (const String& family) #else -//============================================================================== -// The stuff that follows is a mash-up that supports pre-OSX 10.5 APIs. -// (Hopefully all of this can be ditched at some point in the future). - -//============================================================================== -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - #define SUPPORT_10_4_FONTS 1 - #define NEW_CGFONT_FUNCTIONS_UNAVAILABLE (CGFontCreateWithFontName == 0) - - #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 - #define SUPPORT_ONLY_10_4_FONTS 1 - #endif - - } // (juce namespace) - - @interface NSFont (PrivateHack) - - (NSGlyph) _defaultGlyphForChar: (unichar) theChar; - @end - - namespace juce - { -#endif - //============================================================================== class OSXTypeface : public Typeface { @@ -858,31 +834,18 @@ public: [nsFont retain]; - #if SUPPORT_ONLY_10_4_FONTS - initWithATSFont(); - #else - #if SUPPORT_10_4_FONTS - if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) - { - initWithATSFont(); - } - else - #endif - { - fontRef = CGFontCreateWithFontName ((CFStringRef) [nsFont fontName]); + fontRef = CGFontCreateWithFontName ((CFStringRef) [nsFont fontName]); - const float absAscent = std::abs ((float) CGFontGetAscent (fontRef)); - const float totalHeight = absAscent + std::abs ((float) CGFontGetDescent (fontRef)); + const float absAscent = std::abs ((float) CGFontGetAscent (fontRef)); + const float totalHeight = absAscent + std::abs ((float) CGFontGetDescent (fontRef)); - ascent = absAscent / totalHeight; - unitsToHeightScaleFactor = 1.0f / totalHeight; + ascent = absAscent / totalHeight; + unitsToHeightScaleFactor = 1.0f / totalHeight; - const float nsFontAscent = std::abs ([nsFont ascender]); - const float nsFontDescent = std::abs ([nsFont descender]); + const float nsFontAscent = std::abs ([nsFont ascender]); + const float nsFontDescent = std::abs ([nsFont descender]); - fontHeightToPointsFactor = referenceFontSize / (nsFontAscent + nsFontDescent); - } - #endif + fontHeightToPointsFactor = referenceFontSize / (nsFontAscent + nsFontDescent); pathTransform = AffineTransform::identity.scale (unitsToHeightScaleFactor); } @@ -898,27 +861,6 @@ public: CGFontRelease (fontRef); } - #if SUPPORT_10_4_FONTS - void initWithATSFont() - { - ATSFontRef atsFont = ATSFontFindFromName ((CFStringRef) [nsFont fontName], kATSOptionFlagsDefault); - - if (atsFont == 0) - atsFont = ATSFontFindFromPostScriptName ((CFStringRef) [nsFont fontName], kATSOptionFlagsDefault); - - fontRef = CGFontCreateWithPlatformFont (&atsFont); - - const float absAscent = std::abs ([nsFont ascender]); - const float absDescent = std::abs ([nsFont descender]); - const float totalHeight = absAscent + absDescent; - - unitsToHeightScaleFactor = 1.0f / totalHeight; - fontHeightToPointsFactor = referenceFontSize / totalHeight; - ascent = absAscent / totalHeight; - } - #endif - - float getAscent() const override { return ascent; } float getDescent() const override { return 1.0f - ascent; } float getHeightToPointsFactor() const override { return fontHeightToPointsFactor; } @@ -929,37 +871,16 @@ public: return 0; const int length = text.length(); - HeapBlock glyphs; + HeapBlock glyphs; createGlyphsForString (text.getCharPointer(), length, glyphs); float x = 0; -#if SUPPORT_ONLY_10_4_FONTS - HeapBlock advances (length); - [nsFont getAdvancements: advances forGlyphs: reinterpret_cast (glyphs.getData()) count: length]; - - for (int i = 0; i < length; ++i) - x += advances[i].width; -#else - #if SUPPORT_10_4_FONTS - if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) - { - HeapBlock advances (length); - [nsFont getAdvancements: advances forGlyphs: reinterpret_cast (glyphs.getData()) count: length]; + HeapBlock advances (length); + if (CGFontGetGlyphAdvances (fontRef, glyphs, length, advances)) for (int i = 0; i < length; ++i) - x += advances[i].width; - } - else - #endif - { - HeapBlock advances (length); - - if (CGFontGetGlyphAdvances (fontRef, glyphs, length, advances)) - for (int i = 0; i < length; ++i) - x += advances[i]; - } -#endif + x += advances[i]; return x * unitsToHeightScaleFactor; } @@ -972,54 +893,21 @@ public: return; const int length = text.length(); - HeapBlock glyphs; + HeapBlock glyphs; createGlyphsForString (text.getCharPointer(), length, glyphs); -#if SUPPORT_ONLY_10_4_FONTS - HeapBlock advances (length); - [nsFont getAdvancements: advances forGlyphs: reinterpret_cast (glyphs.getData()) count: length]; + HeapBlock advances (length); - int x = 0; - for (int i = 0; i < length; ++i) + if (CGFontGetGlyphAdvances (fontRef, glyphs, length, advances)) { - x += advances[i].width; - xOffsets.add (x * unitsToHeightScaleFactor); - resultGlyphs.add (reinterpret_cast (glyphs.getData())[i]); - } - -#else - #if SUPPORT_10_4_FONTS - if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) - { - HeapBlock advances (length); - NSGlyph* const nsGlyphs = reinterpret_cast (glyphs.getData()); - [nsFont getAdvancements: advances forGlyphs: nsGlyphs count: length]; - - float x = 0; + int x = 0; for (int i = 0; i < length; ++i) { - x += advances[i].width; + x += advances [i]; xOffsets.add (x * unitsToHeightScaleFactor); - resultGlyphs.add (nsGlyphs[i]); + resultGlyphs.add (glyphs[i]); } } - else - #endif - { - HeapBlock advances (length); - - if (CGFontGetGlyphAdvances (fontRef, glyphs, length, advances)) - { - int x = 0; - for (int i = 0; i < length; ++i) - { - x += advances [i]; - xOffsets.add (x * unitsToHeightScaleFactor); - resultGlyphs.add (glyphs[i]); - } - } - } -#endif } bool getOutlineForGlyph (int glyphNumber, Path& path) override @@ -1074,24 +962,8 @@ private: AffineTransform pathTransform; #endif - void createGlyphsForString (String::CharPointerType text, const int length, HeapBlock & glyphs) + void createGlyphsForString (String::CharPointerType text, const int length, HeapBlock& glyphs) { - #if SUPPORT_10_4_FONTS - #if ! SUPPORT_ONLY_10_4_FONTS - if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE) - #endif - { - glyphs.malloc (sizeof (NSGlyph) * length, 1); - NSGlyph* const nsGlyphs = reinterpret_cast (glyphs.getData()); - - for (int i = 0; i < length; ++i) - nsGlyphs[i] = (NSGlyph) [nsFont _defaultGlyphForChar: text.getAndAdvance()]; - - return; - } - #endif - - #if ! SUPPORT_ONLY_10_4_FONTS if (charToGlyphMapper == nullptr) charToGlyphMapper = new CharToGlyphMapper (fontRef); @@ -1099,10 +971,8 @@ private: for (int i = 0; i < length; ++i) glyphs[i] = (CGGlyph) charToGlyphMapper->getGlyphForCharacter (text.getAndAdvance()); - #endif } - #if ! SUPPORT_ONLY_10_4_FONTS // Reads a CGFontRef's character map table to convert unicode into glyph numbers class CharToGlyphMapper { @@ -1200,8 +1070,7 @@ private: } }; - ScopedPointer charToGlyphMapper; - #endif + ScopedPointer charToGlyphMapper; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OSXTypeface) }; diff --git a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm index 99998e4f6a..6f667e413f 100644 --- a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm +++ b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm @@ -87,28 +87,6 @@ public: void updateTopLevelMenu (NSMenuItem* parentItem, const PopupMenu& menuToCopy, const String& name, const int menuId, const int tag) { - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - static bool is10_4 = (SystemStats::getOperatingSystemType() == SystemStats::MacOSX_10_4); - - if (is10_4) - { - [parentItem setTag: tag]; - NSMenu* menu = [parentItem submenu]; - - [menu setTitle: juceStringToNS (name)]; - - while ([menu numberOfItems] > 0) - [menu removeItemAtIndex: 0]; - - for (PopupMenu::MenuItemIterator iter (menuToCopy); iter.next();) - addMenuItem (iter, menu, menuId, tag); - - [menu setAutoenablesItems: false]; - [menu update]; - return; - } - #endif - // Note: This method used to update the contents of the existing menu in-place, but that caused // weird side-effects which messed-up keyboard focus when switching between windows. By creating // a new menu and replacing the old one with it, that problem seems to be avoided.. diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 096bb8f0f3..f16153c77a 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -307,27 +307,10 @@ public: void setAlpha (float newAlpha) override { - if (! isSharedWindow) - { - [window setAlphaValue: (CGFloat) newAlpha]; - } - else - { - #if defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + if (isSharedWindow) [view setAlphaValue: (CGFloat) newAlpha]; - #else - if ([view respondsToSelector: @selector (setAlphaValue:)]) - { - // PITA dynamic invocation for 10.4 builds.. - NSInvocation* inv = [NSInvocation invocationWithMethodSignature: [view methodSignatureForSelector: @selector (setAlphaValue:)]]; - [inv setSelector: @selector (setAlphaValue:)]; - [inv setTarget: view]; - CGFloat cgNewAlpha = (CGFloat) newAlpha; - [inv setArgument: &cgNewAlpha atIndex: 2]; - [inv invoke]; - } - #endif - } + else + [window setAlphaValue: (CGFloat) newAlpha]; } void setMinimised (bool shouldBeMinimised) override @@ -782,16 +765,6 @@ public: handleModifierKeysChange(); } - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - bool redirectPerformKeyEquivalent (NSEvent* ev) - { - if ([ev type] == NSKeyDown) return redirectKeyDown (ev); - if ([ev type] == NSKeyUp) return redirectKeyUp (ev); - - return false; - } - #endif - void drawRect (NSRect r) { if (r.size.width < 1.0f || r.size.height < 1.0f) @@ -1475,10 +1448,6 @@ struct JuceNSViewClass : public ObjCClass addMethod (@selector (resignFirstResponder), resignFirstResponder, "c@:"); addMethod (@selector (acceptsFirstResponder), acceptsFirstResponder, "c@:"); - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - addMethod (@selector (performKeyEquivalent:), performKeyEquivalent, "c@:@"); - #endif - addMethod (@selector (draggingEntered:), draggingEntered, @encode (NSDragOperation), "@:@"); addMethod (@selector (draggingUpdated:), draggingUpdated, @encode (NSDragOperation), "@:@"); addMethod (@selector (draggingEnded:), draggingEnded, "v@:@"); @@ -1706,18 +1675,6 @@ private: owner->redirectModKeyChange (ev); } - #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 - static BOOL performKeyEquivalent (id self, SEL, NSEvent* ev) - { - if (NSViewComponentPeer* const owner = getOwner (self)) - if (owner->redirectPerformKeyEquivalent (ev)) - return true; - - objc_super s = { self, [NSView class] }; - return getMsgSendSuperFn() (&s, @selector (performKeyEquivalent:), ev) != nil; - } - #endif - static BOOL becomeFirstResponder (id self, SEL) { if (NSViewComponentPeer* const owner = getOwner (self)) diff --git a/modules/juce_video/native/juce_mac_CameraDevice.mm b/modules/juce_video/native/juce_mac_CameraDevice.mm index fe0d85019c..d237b69acc 100644 --- a/modules/juce_video/native/juce_mac_CameraDevice.mm +++ b/modules/juce_video/native/juce_mac_CameraDevice.mm @@ -224,11 +224,7 @@ struct CameraDevice::Pimpl { const Time now (Time::getCurrentTime()); - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: QTSampleBufferHostTimeAttribute]; - #else - NSNumber* hosttime = (NSNumber*) [sampleBuffer attributeForKey: nsStringLiteral ("hostTime")]; - #endif int64 presentationTime = (hosttime != nil) ? ((int64) AudioConvertHostTimeToNanos ([hosttime unsignedLongLongValue]) / 1000000 + 40)