Browse Source

macOS: Cleaned up old 10.6 support ifdefs

tags/2021-05-28
Tom Poole 6 years ago
parent
commit
3c0ccda6a5
18 changed files with 24 additions and 188 deletions
  1. +1
    -1
      modules/juce_audio_devices/native/juce_ios_Audio.cpp
  2. +1
    -1
      modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h
  3. +2
    -2
      modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  4. +1
    -3
      modules/juce_audio_processors/juce_audio_processors.cpp
  5. +1
    -1
      modules/juce_core/native/juce_mac_ClangBugWorkaround.h
  6. +2
    -15
      modules/juce_core/native/juce_mac_Files.mm
  7. +2
    -2
      modules/juce_core/native/juce_mac_Network.mm
  8. +2
    -2
      modules/juce_core/native/juce_posix_SharedCode.h
  9. +6
    -6
      modules/juce_core/system/juce_TargetPlatform.h
  10. +1
    -1
      modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm
  11. +0
    -33
      modules/juce_gui_basics/native/juce_mac_FileChooser.mm
  12. +0
    -8
      modules/juce_gui_basics/native/juce_mac_MainMenu.mm
  13. +1
    -6
      modules/juce_gui_basics/native/juce_mac_MouseCursor.mm
  14. +3
    -75
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  15. +0
    -24
      modules/juce_gui_basics/native/juce_mac_Windowing.mm
  16. +1
    -1
      modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm
  17. +0
    -5
      modules/juce_opengl/juce_opengl.h
  18. +0
    -2
      modules/juce_opengl/native/juce_OpenGL_osx.h

+ 1
- 1
modules/juce_audio_devices/native/juce_ios_Audio.cpp View File

@@ -698,7 +698,7 @@ struct iOSAudioIODevice::Pimpl : public AudioPlayHead,
&dataSize);
if (err == noErr)
{
#if (! defined __IPHONE_OS_VERSION_MIN_REQUIRED) || (! defined __IPHONE_10_0) || (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)
#if (! defined __IPHONE_10_0) || (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)
[[UIApplication sharedApplication] openURL: (NSURL*)hostUrl];
#else
[[UIApplication sharedApplication] openURL: (NSURL*)hostUrl options: @{} completionHandler: nil];


+ 1
- 1
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h View File

@@ -68,7 +68,7 @@ private:
#endif
//==============================================================================
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#if (! defined (MAC_OS_X_VERSION_10_12)) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
enum
{
/** Custom AudioUnit property used to indicate MPE support */


+ 2
- 2
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm View File

@@ -40,8 +40,8 @@
#ifndef JUCE_SUPPORTS_AUv3
#if __OBJC2__ \
&& ((defined (MAC_OS_X_VERSION_MIN_REQUIRED) && defined (MAC_OS_X_VERSION_10_11) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)) \
|| (defined (__IPHONE_OS_VERSION_MIN_REQUIRED) && defined (__IPHONE_9_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0)))
&& ((defined (MAC_OS_X_VERSION_10_11) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11)) \
|| (defined (__IPHONE_9_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0)))
#define JUCE_SUPPORTS_AUv3 1
#else
#define JUCE_SUPPORTS_AUv3 0


+ 1
- 3
modules/juce_audio_processors/juce_audio_processors.cpp View File

@@ -41,9 +41,7 @@
//==============================================================================
#if JUCE_MAC
#if JUCE_SUPPORT_CARBON \
&& ((JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU) \
|| ! (defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6))
#if JUCE_SUPPORT_CARBON && (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU)
#include <Carbon/Carbon.h>
#include "../juce_gui_extra/native/juce_mac_CarbonViewWrapperComponent.h"
#endif


+ 1
- 1
modules/juce_core/native/juce_mac_ClangBugWorkaround.h View File

@@ -35,7 +35,7 @@
// In the 10.14 SDK these methods are defined in the <functional> header, which we don't compile
// in the live-build engine, so we'll define them here
#if defined (MAC_OS_X_VERSION_10_14)
#if defined (MAC_OS_X_VERSION_10_14) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
#include <memory>
namespace std { inline namespace __1 {


+ 2
- 15
modules/juce_core/native/juce_mac_Files.mm View File

@@ -36,15 +36,9 @@ bool File::copyInternal (const File& dest) const
NSFileManager* fm = [NSFileManager defaultManager];
return [fm fileExistsAtPath: juceStringToNS (fullPath)]
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
&& [fm copyItemAtPath: juceStringToNS (fullPath)
toPath: juceStringToNS (dest.getFullPathName())
error: nil];
#else
&& [fm copyPath: juceStringToNS (fullPath)
toPath: juceStringToNS (dest.getFullPathName())
handler: nil];
#endif
}
}
@@ -75,7 +69,7 @@ namespace MacFileHelpers
static bool isHiddenFile (const String& path)
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
#if JUCE_MAC
JUCE_AUTORELEASEPOOL
{
NSNumber* hidden = nil;
@@ -84,15 +78,8 @@ namespace MacFileHelpers
return [createNSURLFromFile (path) getResourceValue: &hidden forKey: NSURLIsHiddenKey error: &err]
&& [hidden boolValue];
}
#elif JUCE_IOS
return File (path).getFileName().startsWithChar ('.');
#else
FSRef ref;
LSItemInfoRecord info;
return FSPathMakeRefWithOptions ((const UInt8*) path.toRawUTF8(), kFSPathMakeRefDoNotFollowLeafSymlink, &ref, 0) == noErr
&& LSCopyItemInfoForRef (&ref, kLSRequestBasicFlagsOnly, &info) == noErr
&& (info.flags & kLSItemInfoIsInvisible) != 0;
return File (path).getFileName().startsWithChar ('.');
#endif
}


+ 2
- 2
modules/juce_core/native/juce_mac_Network.mm View File

@@ -110,7 +110,7 @@ bool JUCE_CALLTYPE Process::openEmailWithAttachments (const String& targetEmailA
//==============================================================================
// Unfortunately, we need to have this ugly ifdef here as long as some older OS X versions do not support NSURLSession
#if JUCE_IOS || (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10)
#if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_10) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10)
//==============================================================================
class URLConnectionState : private Thread
@@ -971,7 +971,7 @@ public:
if (! connection->start (owner, webInputListener))
{
// Workaround for deployment targets below 10.10 where HTTPS POST requests with keep-alive fail with the NSURLErrorNetworkConnectionLost error code.
#if ! (JUCE_IOS || (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10))
#if ! (JUCE_IOS || (defined (MAC_OS_X_VERSION_10_10) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10))
if (numRetries == 0 && connection->nsUrlErrorCode == NSURLErrorNetworkConnectionLost)
{
connection.reset();


+ 2
- 2
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -271,7 +271,7 @@ namespace
return statfs (f.getFullPathName().toUTF8(), &result) == 0;
}
#if (JUCE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5) || JUCE_IOS
#if JUCE_MAC || JUCE_IOS
static int64 getCreationTime (const juce_statStruct& s) noexcept { return (int64) s.st_birthtime; }
#else
static int64 getCreationTime (const juce_statStruct& s) noexcept { return (int64) s.st_ctime; }
@@ -402,7 +402,7 @@ void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int
{
modificationTime = (int64) info.st_mtime * 1000;
accessTime = (int64) info.st_atime * 1000;
#if (JUCE_MAC && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5) || JUCE_IOS
#if JUCE_MAC || JUCE_IOS
creationTime = (int64) info.st_birthtime * 1000;
#else
creationTime = (int64) info.st_ctime * 1000;


+ 6
- 6
modules/juce_core/system/juce_TargetPlatform.h View File

@@ -141,12 +141,12 @@
#define JUCE_INTEL 1
#endif
#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_6)
#error "To build with 10.5 compatibility, use a later SDK and set the deployment target to 10.5"
#if JUCE_MAC
#if ! defined (MAC_OS_X_VERSION_10_11)
#error "The 10.11 SDK (Xcode 7.3.1+) is required to build JUCE apps. You can create apps that run on macOS 10.7+ by changing the deployment target."
#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
#error "Building for OSX 10.6 is no longer supported!"
#endif
#endif
#endif


+ 1
- 1
modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm View File

@@ -39,7 +39,7 @@ public:
auto numComponents = (size_t) lineStride * (size_t) jmax (1, height);
# if JUCE_MAC && defined (__MAC_10_14)
# if JUCE_MAC && defined (MAC_OS_X_VERSION_10_14) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
// This version of the SDK intermittently requires a bit of extra space
// at the end of the image data. This feels like something has gone
// wrong in Apple's code.


+ 0
- 33
modules/juce_gui_basics/native/juce_mac_FileChooser.mm View File

@@ -37,13 +37,10 @@ static NSMutableArray* createAllowedTypesArray (const StringArray& filters)
for (int i = 0; i < filters.size(); ++i)
{
#if defined (MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
// From OS X 10.6 you can only specify allowed extensions, so any filters containing wildcards
// must be of the form "*.extension"
jassert (filters[i] == "*"
|| (filters[i].startsWith ("*.") && filters[i].lastIndexOfChar ('*') == 0));
#endif
const String f (filters[i].replace ("*.", ""));
if (f == "*")
@@ -122,10 +119,8 @@ public:
filename = owner.startingFile.getFileName();
}
#if defined (MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
[panel setDirectoryURL: createNSURLFromFile (startingDirectory)];
[panel setNameFieldStringValue: juceStringToNS (filename)];
#endif
}
~Native() override
@@ -178,13 +173,7 @@ public:
tempMenu.reset (new TemporaryMainMenuWithStandardCommands());
jassert (panel != nil);
#if defined (MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
auto result = [panel runModal];
#else
auto result = [panel runModalForDirectory: juceStringToNS (startingDirectory)
file: juceStringToNS (filename)];
#endif
finished (result);
}
@@ -198,11 +187,7 @@ public:
private:
//==============================================================================
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
typedef NSObject<NSOpenSavePanelDelegate> DelegateType;
#else
typedef NSObject DelegateType;
#endif
void finished (NSInteger result)
{
@@ -254,22 +239,6 @@ private:
if (f.getFileName().matchesWildcard (filters[i], true))
return true;
#if (! defined (MAC_OS_X_VERSION_10_7)) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
NSError* error;
NSString* name = [[NSWorkspace sharedWorkspace] typeOfFile: nsFilename error: &error];
if ([name isEqualToString: nsStringLiteral ("com.apple.alias-file")])
{
FSRef ref;
FSPathMakeRef ((const UInt8*) [nsFilename fileSystemRepresentation], &ref, nullptr);
Boolean targetIsFolder = false, wasAliased = false;
FSResolveAliasFileWithMountFlags (&ref, true, &targetIsFolder, &wasAliased, 0);
return wasAliased && targetIsFolder;
}
#endif
return f.isDirectory()
&& ! [[NSWorkspace sharedWorkspace] isFilePackageAtPath: nsFilename];
}
@@ -322,9 +291,7 @@ private:
addMethod (@selector (panel:shouldShowFilename:), shouldShowFilename, "c@:@@");
addMethod (@selector (panelSelectionDidChange:), panelSelectionDidChange, "c@");
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
addProtocol (@protocol (NSOpenSavePanelDelegate));
#endif
registerClass();
}


+ 0
- 8
modules/juce_gui_basics/native/juce_mac_MainMenu.mm View File

@@ -327,13 +327,7 @@ public:
[m setAutoenablesItems: false];
if (addDelegate)
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[m setDelegate: (id<NSMenuDelegate>) callback];
#else
[m setDelegate: callback];
#endif
}
for (PopupMenu::MenuItemIterator iter (menu); iter.next();)
addMenuItem (iter, m, topLevelMenuId, topLevelIndex);
@@ -515,9 +509,7 @@ private:
addMethod (@selector (menuItemInvoked:), menuItemInvoked, "v@:@");
addMethod (@selector (menuNeedsUpdate:), menuNeedsUpdate, "v@:@");
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
addProtocol (@protocol (NSMenuDelegate));
#endif
registerClass();
}


+ 1
- 6
modules/juce_gui_basics/native/juce_mac_MouseCursor.mm View File

@@ -113,12 +113,7 @@ void* MouseCursor::createStandardMouseCursor (MouseCursor::StandardCursorType ty
case CopyingCursor:
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
if (void* m = MouseCursorHelpers::fromHIServices ("copy"))
return m;
#endif
c = [NSCursor dragCopyCursor]; // added in 10.6
c = [NSCursor dragCopyCursor];
break;
}


+ 3
- 75
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -32,18 +32,6 @@ namespace juce
extern CheckEventBlockedByModalComps isEventBlockedByModalComps;
}
//==============================================================================
#if ! (defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
@interface NSEvent (JuceDeviceDelta)
- (CGFloat) scrollingDeltaX;
- (CGFloat) scrollingDeltaY;
- (BOOL) hasPreciseScrollingDeltas;
- (BOOL) isDirectionInvertedFromDevice;
@end
#endif
namespace juce
{
@@ -114,15 +102,11 @@ public:
defer: YES];
setOwner (window, this);
[window orderOut: nil];
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[window setDelegate: (id<NSWindowDelegate>) window];
#else
[window setDelegate: window];
#endif
[window setOpaque: component.isOpaque()];
#if defined (MAC_OS_X_VERSION_10_14)
#if defined (MAC_OS_X_VERSION_10_14) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14)
if (! [window isOpaque])
[window setBackgroundColor: [NSColor clearColor]];
@@ -148,13 +132,11 @@ public:
[window setExcludedFromWindowsMenu: (windowStyleFlags & windowIsTemporary) != 0];
[window setIgnoresMouseEvents: (windowStyleFlags & windowIgnoresMouseClicks) != 0];
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
if ((windowStyleFlags & (windowHasMaximiseButton | windowHasTitleBar)) == (windowHasMaximiseButton | windowHasTitleBar))
[window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
if ([window respondsToSelector: @selector (setRestorable:)])
[window setRestorable: NO];
#endif
#if defined (MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
if ([window respondsToSelector: @selector (setTabbingMode:)])
@@ -191,10 +173,8 @@ public:
getNativeRealtimeModifiers = []
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if ([NSEvent respondsToSelector: @selector (modifierFlags)])
NSViewComponentPeer::updateModifiers ([NSEvent modifierFlags]);
#endif
return ModifierKeys::currentModifiers;
};
@@ -315,12 +295,7 @@ public:
if (global && viewWindow != nil)
{
r = [[view superview] convertRect: r toView: nil];
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
r = [viewWindow convertRectToScreen: r];
#else
r.origin = [viewWindow convertBaseToScreen: r.origin];
#endif
flipScreenRect (r);
}
@@ -412,10 +387,8 @@ public:
static bool isWindowAtPoint (NSWindow* w, NSPoint screenPoint)
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
if ([NSWindow respondsToSelector: @selector (windowNumberAtPoint:belowWindowWithWindowNumber:)])
return [NSWindow windowNumberAtPoint: screenPoint belowWindowWithWindowNumber: 0] == [w windowNumber];
#endif
return true;
}
@@ -472,9 +445,7 @@ public:
{
if (hasNativeTitleBar())
{
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
isWindowInKioskMode = (([window styleMask] & NSWindowStyleMaskFullScreen) != 0);
#endif
auto screen = getFrameSize().subtractedFrom (component.getParentMonitorArea());
@@ -621,12 +592,7 @@ public:
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons();
NSPoint windowPos = [ev locationInWindow];
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
NSPoint screenPos = [[ev window] convertRectToScreen: NSMakeRect (windowPos.x, windowPos.y, 1.0f, 1.0f)].origin;
#else
NSPoint screenPos = [[ev window] convertBaseToScreen: windowPos];
#endif
if (isWindowAtPoint ([ev window], screenPos))
sendMouseEvent (ev);
@@ -671,7 +637,6 @@ public:
@try
{
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if ([ev respondsToSelector: @selector (isDirectionInvertedFromDevice)])
wheel.isReversed = [ev isDirectionInvertedFromDevice];
@@ -687,9 +652,7 @@ public:
wheel.isSmooth = true;
}
}
else
#endif
if ([ev respondsToSelector: @selector (deviceDeltaX)])
else if ([ev respondsToSelector: @selector (deviceDeltaX)])
{
wheel.deltaX = checkDeviceDeltaReturnValue ((float) getMsgSendFPRetFn() (ev, @selector (deviceDeltaX)));
wheel.deltaY = checkDeviceDeltaReturnValue ((float) getMsgSendFPRetFn() (ev, @selector (deviceDeltaY)));
@@ -710,13 +673,10 @@ public:
void redirectMagnify (NSEvent* ev)
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
const float invScale = 1.0f - (float) [ev magnification];
if (invScale > 0.0f)
handleMagnifyGesture (MouseInputSource::InputSourceType::mouse, getMousePos (ev, view), getMouseTime (ev), 1.0f / invScale);
#endif
ignoreUnused (ev);
}
void redirectCopy (NSObject*) { handleKeyPress (KeyPress ('c', ModifierKeys (ModifierKeys::commandModifier), 'c')); }
@@ -850,12 +810,10 @@ public:
CGContextClearRect (cg, CGContextGetClipBoundingBox (cg));
float displayScale = 1.0f;
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
NSScreen* screen = [[view window] screen];
if ([screen respondsToSelector: @selector (backingScaleFactor)])
displayScale = (float) screen.backingScaleFactor;
#endif
#if USE_COREGRAPHICS_RENDERING && JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS
// This option invokes a separate paint call for each rectangle of the clip region.
@@ -1102,12 +1060,7 @@ public:
auto screenBounds = Desktop::getInstance().getDisplays().getTotalBounds (true);
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
const bool inLiveResize = [window inLiveResize];
#else
const bool inLiveResize = [window respondsToSelector: @selector (inLiveResize)]
&& [window performSelector: @selector (inLiveResize)];
#endif
if (! inLiveResize || isFirstLiveResize)
{
@@ -1967,9 +1920,7 @@ struct JuceNSWindowClass : public ObjCClass<NSWindow>
addMethod (@selector (window:shouldDragDocumentWithEvent:from:withPasteboard:),
shouldAllowIconDrag, "B@:@", @encode (NSEvent*), @encode (NSPoint), @encode (NSPasteboard*));
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
addProtocol (@protocol (NSWindowDelegate));
#endif
registerClass();
}
@@ -2042,9 +1993,7 @@ private:
static void windowDidExitFullScreen (id, SEL, NSNotification*)
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
#endif
}
static void zoom (id self, SEL, id sender)
@@ -2150,12 +2099,9 @@ bool MouseInputSource::SourceList::canUseTouch()
//==============================================================================
void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, bool allowMenusAndBars)
{
#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
auto* peer = dynamic_cast<NSViewComponentPeer*> (kioskComp->getPeer());
jassert (peer != nullptr); // (this should have been checked by the caller)
#if defined (MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (peer->hasNativeTitleBar()
&& [peer->window respondsToSelector: @selector (toggleFullScreen:)])
{
@@ -2167,7 +2113,6 @@ void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, boo
[peer->window performSelector: @selector (toggleFullScreen:) withObject: nil];
}
else
#endif
{
if (shouldBeEnabled)
{
@@ -2190,23 +2135,6 @@ void Desktop::setKioskComponent (Component* kioskComp, bool shouldBeEnabled, boo
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
}
}
#elif JUCE_SUPPORT_CARBON
if (shouldBeEnabled)
{
SetSystemUIMode (kUIModeAllSuppressed, allowMenusAndBars ? kUIOptionAutoShowMenuBar : 0);
kioskComp->setBounds (Desktop::getInstance().getDisplays().getMainDisplay().totalArea);
}
else
{
SetSystemUIMode (kUIModeNormal, 0);
}
#else
ignoreUnused (kioskComp, shouldBeEnabled, allowMenusAndBars);
// If you're targeting OSes earlier than 10.6 and want to use this feature,
// you'll need to enable JUCE_SUPPORT_CARBON.
jassertfalse;
#endif
}
void Desktop::allowedOrientationsChanged() {}


+ 0
- 24
modules/juce_gui_basics/native/juce_mac_Windowing.mm View File

@@ -377,18 +377,9 @@ Desktop::DisplayOrientation Desktop::getCurrentOrientation() const
}
//==============================================================================
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
#define JUCE_USE_IOPM_SCREENSAVER_DEFEAT 1
#endif
#if ! (defined (JUCE_USE_IOPM_SCREENSAVER_DEFEAT) || defined (__POWER__))
extern "C" { extern OSErr UpdateSystemActivity (UInt8); } // Some versions of the SDK omit this function..
#endif
class ScreenSaverDefeater : public Timer
{
public:
#if JUCE_USE_IOPM_SCREENSAVER_DEFEAT
ScreenSaverDefeater()
{
startTimer (5000);
@@ -429,19 +420,6 @@ public:
};
std::unique_ptr<PMAssertion> assertion;
#else
ScreenSaverDefeater()
{
startTimer (10000);
timerCallback();
}
void timerCallback() override
{
if (Process::isForegroundProcess())
UpdateSystemActivity (1 /*UsrActivity*/);
}
#endif
};
static std::unique_ptr<ScreenSaverDefeater> screenSaverDefeater;
@@ -504,10 +482,8 @@ static Displays::Display getDisplayFromScreen (NSScreen* s, CGFloat& mainScreenB
d.totalArea = convertDisplayRect ([s frame], mainScreenBottom) / masterScale;
d.scale = masterScale;
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
if ([s respondsToSelector: @selector (backingScaleFactor)])
d.scale *= s.backingScaleFactor;
#endif
NSSize dpi = [[[s deviceDescription] objectForKey: NSDeviceResolution] sizeValue];
d.dpi = (dpi.width + dpi.height) / 2.0;


+ 1
- 1
modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm View File

@@ -283,7 +283,7 @@ public:
{
NSString* urlString = juceStringToNS (url);
#if (JUCE_MAC && (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_9) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9)) || (JUCE_IOS && (defined (__IPHONE_OS_VERSION_MIN_REQUIRED) && defined (__IPHONE_7_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0))
#if (JUCE_MAC && (defined (MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9)) || (JUCE_IOS && (defined (__IPHONE_7_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0))
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
#else
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


+ 0
- 5
modules/juce_opengl/juce_opengl.h View File

@@ -98,14 +98,9 @@
#include <OpenGLES/ES2/gl.h>
#endif
#elif JUCE_MAC
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
#define JUCE_OPENGL3 1
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
#else
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#endif
#elif JUCE_ANDROID
#include <android/native_window.h>
#include <android/native_window_jni.h>


+ 0
- 2
modules/juce_opengl/native/juce_OpenGL_osx.h View File

@@ -45,10 +45,8 @@ public:
view = [cls.createInstance() initWithFrame: NSMakeRect (0, 0, 100.0f, 100.0f)
pixelFormat: format];
#if defined (MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
if ([view respondsToSelector: @selector (setWantsBestResolutionOpenGLSurface:)])
[view setWantsBestResolutionOpenGLSurface: YES];
#endif
[[NSNotificationCenter defaultCenter] addObserver: view
selector: @selector (_surfaceNeedsUpdate:)


Loading…
Cancel
Save