mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Platform: Remove compatibility checks for macOS 10.9
This commit is contained in:
parent
da8c5fdcb4
commit
6d4bf60330
8 changed files with 82 additions and 135 deletions
|
|
@ -42,15 +42,13 @@ class ScopedLowPowerModeDisabler::Pimpl
|
|||
public:
|
||||
Pimpl()
|
||||
{
|
||||
if (@available (macOS 10.9, *))
|
||||
activity = [[NSProcessInfo processInfo] beginActivityWithOptions: NSActivityUserInitiatedAllowingIdleSystemSleep
|
||||
reason: @"App must remain in high-power mode"];
|
||||
activity = [[NSProcessInfo processInfo] beginActivityWithOptions: NSActivityUserInitiatedAllowingIdleSystemSleep
|
||||
reason: @"App must remain in high-power mode"];
|
||||
}
|
||||
|
||||
~Pimpl()
|
||||
{
|
||||
if (@available (macOS 10.9, *))
|
||||
[[NSProcessInfo processInfo] endActivity: activity];
|
||||
[[NSProcessInfo processInfo] endActivity: activity];
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -872,27 +872,15 @@ static void sendHandlerNotification (const AccessibilityHandler& handler,
|
|||
if (! areAnyAccessibilityClientsActive() || notification == NSAccessibilityNotificationName{})
|
||||
return;
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
if (id accessibilityElement = static_cast<id> (handler.getNativeImplementation()))
|
||||
{
|
||||
if (id accessibilityElement = static_cast<id> (handler.getNativeImplementation()))
|
||||
{
|
||||
sendAccessibilityEvent (accessibilityElement, notification,
|
||||
(notification == NSAccessibilityLayoutChangedNotification
|
||||
? @{ NSAccessibilityUIElementsKey: @[ accessibilityElement ] }
|
||||
: nil));
|
||||
}
|
||||
sendAccessibilityEvent (accessibilityElement, notification,
|
||||
(notification == NSAccessibilityLayoutChangedNotification
|
||||
? @{ NSAccessibilityUIElementsKey: @[ accessibilityElement ] }
|
||||
: nil));
|
||||
}
|
||||
}
|
||||
|
||||
static NSAccessibilityNotificationName layoutChangedNotification()
|
||||
{
|
||||
if (@available (macOS 10.9, *))
|
||||
return NSAccessibilityLayoutChangedNotification;
|
||||
|
||||
static NSString* layoutChangedString = @"AXLayoutChanged";
|
||||
return layoutChangedString;
|
||||
}
|
||||
|
||||
void detail::AccessibilityHelpers::notifyAccessibilityEvent (const AccessibilityHandler& handler, Event eventType)
|
||||
{
|
||||
auto notification = [eventType]
|
||||
|
|
@ -901,7 +889,7 @@ void detail::AccessibilityHelpers::notifyAccessibilityEvent (const Accessibility
|
|||
{
|
||||
case Event::elementCreated: return NSAccessibilityCreatedNotification;
|
||||
case Event::elementDestroyed: return NSAccessibilityUIElementDestroyedNotification;
|
||||
case Event::elementMovedOrResized: return layoutChangedNotification();
|
||||
case Event::elementMovedOrResized: return NSAccessibilityLayoutChangedNotification;
|
||||
case Event::focusChanged: return NSAccessibilityFocusedUIElementChangedNotification;
|
||||
case Event::windowOpened: return NSAccessibilityWindowCreatedNotification;
|
||||
case Event::windowClosed: break;
|
||||
|
|
@ -925,7 +913,7 @@ void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent eventTyp
|
|||
case AccessibilityEvent::textChanged:
|
||||
case AccessibilityEvent::valueChanged: return NSAccessibilityValueChangedNotification;
|
||||
case AccessibilityEvent::titleChanged: return NSAccessibilityTitleChangedNotification;
|
||||
case AccessibilityEvent::structureChanged: return layoutChangedNotification();
|
||||
case AccessibilityEvent::structureChanged: return NSAccessibilityLayoutChangedNotification;
|
||||
}
|
||||
|
||||
return NSAccessibilityNotificationName{};
|
||||
|
|
@ -939,31 +927,28 @@ void AccessibilityHandler::postAnnouncement (const String& announcementString, A
|
|||
if (! areAnyAccessibilityClientsActive())
|
||||
return;
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
auto nsPriority = [priority]
|
||||
{
|
||||
auto nsPriority = [priority]
|
||||
// The below doesn't get noticed by the @available check above
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunguarded-availability")
|
||||
|
||||
switch (priority)
|
||||
{
|
||||
// The below doesn't get noticed by the @available check above
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunguarded-availability")
|
||||
case AnnouncementPriority::low: return NSAccessibilityPriorityLow;
|
||||
case AnnouncementPriority::medium: return NSAccessibilityPriorityMedium;
|
||||
case AnnouncementPriority::high: return NSAccessibilityPriorityHigh;
|
||||
}
|
||||
|
||||
switch (priority)
|
||||
{
|
||||
case AnnouncementPriority::low: return NSAccessibilityPriorityLow;
|
||||
case AnnouncementPriority::medium: return NSAccessibilityPriorityMedium;
|
||||
case AnnouncementPriority::high: return NSAccessibilityPriorityHigh;
|
||||
}
|
||||
jassertfalse;
|
||||
return NSAccessibilityPriorityLow;
|
||||
|
||||
jassertfalse;
|
||||
return NSAccessibilityPriorityLow;
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
}();
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
}();
|
||||
|
||||
sendAccessibilityEvent (static_cast<id> ([NSApp mainWindow]),
|
||||
NSAccessibilityAnnouncementRequestedNotification,
|
||||
@{ NSAccessibilityAnnouncementKey: juceStringToNS (announcementString),
|
||||
NSAccessibilityPriorityKey: @(nsPriority) });
|
||||
}
|
||||
sendAccessibilityEvent (static_cast<id> ([NSApp mainWindow]),
|
||||
NSAccessibilityAnnouncementRequestedNotification,
|
||||
@{ NSAccessibilityAnnouncementKey: juceStringToNS (announcementString),
|
||||
NSAccessibilityPriorityKey: @(nsPriority) });
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -255,17 +255,7 @@ private:
|
|||
|
||||
exitModalState (0);
|
||||
|
||||
const auto okResult = []() -> NSInteger
|
||||
{
|
||||
if (@available (macOS 10.9, *))
|
||||
return NSModalResponseOK;
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
return NSFileHandlingPanelOKButton;
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
}();
|
||||
|
||||
if (panel != nil && result == okResult)
|
||||
if (panel != nil && result == NSModalResponseOK)
|
||||
{
|
||||
auto addURLResult = [&chooserResults] (NSURL* urlToAdd)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -261,8 +261,7 @@ public:
|
|||
if (! [window isOpaque])
|
||||
[window setBackgroundColor: [NSColor clearColor]];
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
[view setAppearance: [NSAppearance appearanceNamed: NSAppearanceNameAqua]];
|
||||
[view setAppearance: [NSAppearance appearanceNamed: NSAppearanceNameAqua]];
|
||||
|
||||
[window setHasShadow: ((windowStyleFlags & windowHasDropShadow) != 0)];
|
||||
|
||||
|
|
@ -2783,9 +2782,6 @@ struct JuceNSWindowClass final : public NSViewComponentPeerWrapper<ObjCClass<NSW
|
|||
|
||||
addMethod (@selector (windowWillEnterFullScreen:), [] (id self, SEL, NSNotification*)
|
||||
{
|
||||
if (SystemStats::getOperatingSystemType() <= SystemStats::MacOSX_10_9)
|
||||
return;
|
||||
|
||||
if (auto* owner = getOwner (self))
|
||||
if (owner->hasNativeTitleBar() && (owner->getStyleFlags() & ComponentPeer::windowIsResizable) == 0)
|
||||
[owner->window setStyleMask: NSWindowStyleMaskBorderless];
|
||||
|
|
|
|||
|
|
@ -60,15 +60,12 @@ std::unique_ptr<ScopedMessageBoxInterface> ScopedMessageBoxInterface::create (co
|
|||
{
|
||||
if (auto* window = [view window])
|
||||
{
|
||||
if (@available (macOS 10.9, *))
|
||||
[alertWindow.get() beginSheetModalForWindow: window completionHandler: ^(NSModalResponse result)
|
||||
{
|
||||
[alertWindow.get() beginSheetModalForWindow: window completionHandler: ^(NSModalResponse result)
|
||||
{
|
||||
onDone (result);
|
||||
}];
|
||||
onDone (result);
|
||||
}];
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,52 +85,49 @@ namespace PushNotificationsDelegateDetailsOsx
|
|||
if (n.actions.size() > 0)
|
||||
notification.actionButtonTitle = juceStringToNS (n.actions.getReference (0).title);
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
notification.identifier = juceStringToNS (n.identifier);
|
||||
|
||||
if (n.actions.size() > 0)
|
||||
{
|
||||
notification.identifier = juceStringToNS (n.identifier);
|
||||
notification.hasReplyButton = n.actions.getReference (0).style == Action::text;
|
||||
notification.responsePlaceholder = juceStringToNS (n.actions.getReference (0).textInputPlaceholder);
|
||||
}
|
||||
|
||||
if (n.actions.size() > 0)
|
||||
auto* imageDirectory = n.icon.contains ("/")
|
||||
? juceStringToNS (n.icon.upToLastOccurrenceOf ("/", false, true))
|
||||
: [NSString string];
|
||||
|
||||
auto* imageName = juceStringToNS (n.icon.fromLastOccurrenceOf ("/", false, false)
|
||||
.upToLastOccurrenceOf (".", false, false));
|
||||
auto* imageExtension = juceStringToNS (n.icon.fromLastOccurrenceOf (".", false, false));
|
||||
|
||||
NSString* imagePath = nil;
|
||||
|
||||
if ([imageDirectory length] == NSUInteger (0))
|
||||
{
|
||||
imagePath = [[NSBundle mainBundle] pathForResource: imageName
|
||||
ofType: imageExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
imagePath = [[NSBundle mainBundle] pathForResource: imageName
|
||||
ofType: imageExtension
|
||||
inDirectory: imageDirectory];
|
||||
}
|
||||
|
||||
notification.contentImage = [[NSImage alloc] initWithContentsOfFile: imagePath];
|
||||
|
||||
if (@available (macOS 10.10, *))
|
||||
{
|
||||
if (n.actions.size() > 1)
|
||||
{
|
||||
notification.hasReplyButton = n.actions.getReference (0).style == Action::text;
|
||||
notification.responsePlaceholder = juceStringToNS (n.actions.getReference (0).textInputPlaceholder);
|
||||
}
|
||||
auto additionalActions = [NSMutableArray arrayWithCapacity: (NSUInteger) n.actions.size() - 1];
|
||||
|
||||
auto* imageDirectory = n.icon.contains ("/")
|
||||
? juceStringToNS (n.icon.upToLastOccurrenceOf ("/", false, true))
|
||||
: [NSString string];
|
||||
for (int a = 1; a < n.actions.size(); ++a)
|
||||
[additionalActions addObject: [NSUserNotificationAction actionWithIdentifier: juceStringToNS (n.actions[a].identifier)
|
||||
title: juceStringToNS (n.actions[a].title)]];
|
||||
|
||||
auto* imageName = juceStringToNS (n.icon.fromLastOccurrenceOf ("/", false, false)
|
||||
.upToLastOccurrenceOf (".", false, false));
|
||||
auto* imageExtension = juceStringToNS (n.icon.fromLastOccurrenceOf (".", false, false));
|
||||
|
||||
NSString* imagePath = nil;
|
||||
|
||||
if ([imageDirectory length] == NSUInteger (0))
|
||||
{
|
||||
imagePath = [[NSBundle mainBundle] pathForResource: imageName
|
||||
ofType: imageExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
imagePath = [[NSBundle mainBundle] pathForResource: imageName
|
||||
ofType: imageExtension
|
||||
inDirectory: imageDirectory];
|
||||
}
|
||||
|
||||
notification.contentImage = [[NSImage alloc] initWithContentsOfFile: imagePath];
|
||||
|
||||
if (@available (macOS 10.10, *))
|
||||
{
|
||||
if (n.actions.size() > 1)
|
||||
{
|
||||
auto additionalActions = [NSMutableArray arrayWithCapacity: (NSUInteger) n.actions.size() - 1];
|
||||
|
||||
for (int a = 1; a < n.actions.size(); ++a)
|
||||
[additionalActions addObject: [NSUserNotificationAction actionWithIdentifier: juceStringToNS (n.actions[a].identifier)
|
||||
title: juceStringToNS (n.actions[a].title)]];
|
||||
|
||||
notification.additionalActions = additionalActions;
|
||||
}
|
||||
notification.additionalActions = additionalActions;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,13 +162,10 @@ namespace PushNotificationsDelegateDetailsOsx
|
|||
notif.soundToPlay = URL (nsStringToJuce (n.soundName));
|
||||
notif.properties = nsDictionaryToVar (n.userInfo);
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
{
|
||||
notif.identifier = nsStringToJuce (n.identifier);
|
||||
notif.identifier = nsStringToJuce (n.identifier);
|
||||
|
||||
if (n.contentImage != nil)
|
||||
notif.icon = nsStringToJuce ([n.contentImage name]);
|
||||
}
|
||||
if (n.contentImage != nil)
|
||||
notif.icon = nsStringToJuce ([n.contentImage name]);
|
||||
|
||||
Array<Action> actions;
|
||||
|
||||
|
|
@ -180,14 +174,11 @@ namespace PushNotificationsDelegateDetailsOsx
|
|||
Action action;
|
||||
action.title = nsStringToJuce (n.actionButtonTitle);
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
{
|
||||
if (n.hasReplyButton)
|
||||
action.style = Action::text;
|
||||
if (n.hasReplyButton)
|
||||
action.style = Action::text;
|
||||
|
||||
if (n.responsePlaceholder != nil)
|
||||
action.textInputPlaceholder = nsStringToJuce (n.responsePlaceholder);
|
||||
}
|
||||
if (n.responsePlaceholder != nil)
|
||||
action.textInputPlaceholder = nsStringToJuce (n.responsePlaceholder);
|
||||
|
||||
actions.add (action);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,16 +72,7 @@ static NSMutableURLRequest* getRequestForURL (const String& url, const StringArr
|
|||
{
|
||||
NSString* urlString = juceStringToNS (url);
|
||||
|
||||
if (@available (macOS 10.9, *))
|
||||
{
|
||||
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters: [NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
}
|
||||
else
|
||||
{
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
urlString = [urlString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
}
|
||||
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters: [NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
|
||||
if (NSURL* nsURL = [NSURL URLWithString: urlString])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -597,9 +597,8 @@ private:
|
|||
{
|
||||
wrappedPlayer = [&]() -> std::unique_ptr<WrappedPlayer>
|
||||
{
|
||||
if (@available (macOS 10.9, *))
|
||||
if (useNativeControls)
|
||||
return std::make_unique<WrappedPlayerView>();
|
||||
if (useNativeControls)
|
||||
return std::make_unique<WrappedPlayerView>();
|
||||
|
||||
return std::make_unique<WrappedPlayerLayer>();
|
||||
}();
|
||||
|
|
@ -669,7 +668,7 @@ private:
|
|||
NSUniquePtr<AVPlayerLayer> playerLayer { [[AVPlayerLayer alloc] init] };
|
||||
};
|
||||
|
||||
class API_AVAILABLE (macos (10.9)) WrappedPlayerView : public WrappedPlayer
|
||||
class WrappedPlayerView : public WrappedPlayer
|
||||
{
|
||||
public:
|
||||
WrappedPlayerView() = default;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue