1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Stripped out some defunct OSX 10.4 fallback code

This commit is contained in:
jules 2015-12-01 12:48:01 +00:00
parent 23395691b1
commit 31381c6864
15 changed files with 56 additions and 333 deletions

View file

@ -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<double> sampleRates;
Array<int> bufferSizes;
AudioIODeviceCallback* callback;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
AudioDeviceIOProcID audioProcID;
#endif
private:
CriticalSection callbackLock;

View file

@ -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:
{

View file

@ -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)

View file

@ -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 <typename Type> static Type OSAtomicAdd64Barrier (Type b, JUCE_MAC_ATOMICS_VOLATILE Type* a) noexcept { jassertfalse; return *a += b; }
template <typename Type> static Type OSAtomicIncrement64Barrier (JUCE_MAC_ATOMICS_VOLATILE Type* a) noexcept { jassertfalse; return ++*a; }
template <typename Type> static Type OSAtomicDecrement64Barrier (JUCE_MAC_ATOMICS_VOLATILE Type* a) noexcept { jassertfalse; return --*a; }
template <typename Type> static bool OSAtomicCompareAndSwap64Barrier (Type old, Type newValue, JUCE_MAC_ATOMICS_VOLATILE Type* value) noexcept
template <typename Type> static Type OSAtomicAdd64Barrier (Type b, volatile Type* a) noexcept { jassertfalse; return *a += b; }
template <typename Type> static Type OSAtomicIncrement64Barrier (volatile Type* a) noexcept { jassertfalse; return ++*a; }
template <typename Type> static Type OSAtomicDecrement64Barrier (volatile Type* a) noexcept { jassertfalse; return --*a; }
template <typename Type> 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 <typename Type>
inline Type Atomic<Type>::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<Type>::add (const_cast<volatile Type*> (&value), (Type) 0);
#elif JUCE_ATOMICS_GCC
@ -366,8 +360,8 @@ template <typename Type>
inline Type Atomic<Type>::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<Type>::add (&value, amountToAdd);
#elif JUCE_ATOMICS_GCC
@ -385,8 +379,8 @@ template <typename Type>
inline Type Atomic<Type>::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<Type>::inc (&value);
#elif JUCE_ATOMICS_GCC
@ -399,8 +393,8 @@ template <typename Type>
inline Type Atomic<Type>::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<Type>::dec (&value);
#elif JUCE_ATOMICS_GCC
@ -413,8 +407,8 @@ template <typename Type>
inline bool Atomic<Type>::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

View file

@ -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];
}
}

View file

@ -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

View file

@ -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)];

View file

@ -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

View file

@ -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()

View file

@ -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;

View file

@ -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;

View file

@ -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 <int>& resultGlyphs, Array <float>& xOffsets) override
void getGlyphPositions (const String& text, Array<int>& resultGlyphs, Array<float>& 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 <CGGlyph> glyphs;
HeapBlock<CGGlyph> glyphs;
createGlyphsForString (text.getCharPointer(), length, glyphs);
float x = 0;
#if SUPPORT_ONLY_10_4_FONTS
HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast<NSGlyph*> (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 <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast<NSGlyph*> (glyphs.getData()) count: length];
HeapBlock<int> advances (length);
if (CGFontGetGlyphAdvances (fontRef, glyphs, length, advances))
for (int i = 0; i < length; ++i)
x += advances[i].width;
}
else
#endif
{
HeapBlock <int> 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 <CGGlyph> glyphs;
HeapBlock<CGGlyph> glyphs;
createGlyphsForString (text.getCharPointer(), length, glyphs);
#if SUPPORT_ONLY_10_4_FONTS
HeapBlock <NSSize> advances (length);
[nsFont getAdvancements: advances forGlyphs: reinterpret_cast <NSGlyph*> (glyphs.getData()) count: length];
HeapBlock<int> 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 <NSGlyph*> (glyphs.getData())[i]);
}
#else
#if SUPPORT_10_4_FONTS
if (NEW_CGFONT_FUNCTIONS_UNAVAILABLE)
{
HeapBlock <NSSize> advances (length);
NSGlyph* const nsGlyphs = reinterpret_cast<NSGlyph*> (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 <int> 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 <CGGlyph>& glyphs)
void createGlyphsForString (String::CharPointerType text, const int length, HeapBlock<CGGlyph>& 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<NSGlyph*> (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> charToGlyphMapper;
#endif
ScopedPointer<CharToGlyphMapper> charToGlyphMapper;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OSXTypeface)
};

View file

@ -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..

View file

@ -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 <NSView>
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))

View file

@ -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)