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

Platform: Remove build-time Apple SDK availability checks

This commit is contained in:
reuk 2024-07-01 22:21:33 +01:00
parent 5c1b75cab7
commit b89553ae2c
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
10 changed files with 12 additions and 119 deletions

View file

@ -37,18 +37,6 @@
#undef JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS
#endif
#if defined (__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
#define JUCE_HAS_IOS_POINTER_SUPPORT 1
#else
#define JUCE_HAS_IOS_POINTER_SUPPORT 0
#endif
#if defined (__IPHONE_13_4) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_4
#define JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT 1
#else
#define JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT 0
#endif
namespace juce
{
@ -120,14 +108,12 @@ static UIInterfaceOrientation getWindowOrientation()
{
UIApplication* sharedApplication = [UIApplication sharedApplication];
#if defined (__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available (iOS 13.0, *))
{
for (UIScene* scene in [sharedApplication connectedScenes])
if ([scene isKindOfClass: [UIWindowScene class]])
return [(UIWindowScene*) scene interfaceOrientation];
}
#endif
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
return [sharedApplication statusBarOrientation];
@ -335,10 +321,8 @@ struct CADisplayLinkDeleter
- (void) touchesEnded: (NSSet*) touches withEvent: (UIEvent*) event;
- (void) touchesCancelled: (NSSet*) touches withEvent: (UIEvent*) event;
#if JUCE_HAS_IOS_POINTER_SUPPORT
- (void) onHover: (UIHoverGestureRecognizer*) gesture API_AVAILABLE (ios (13.0));
- (void) onScroll: (UIPanGestureRecognizer*) gesture;
#endif
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
@ -454,10 +438,8 @@ public:
void handleTouches (UIEvent*, MouseEventFlags);
#if JUCE_HAS_IOS_POINTER_SUPPORT
API_AVAILABLE (ios (13.0)) void onHover (UIHoverGestureRecognizer*);
void onScroll (UIPanGestureRecognizer*);
#endif
Range<int> getMarkedTextRange() const
{
@ -661,7 +643,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
- (UIStatusBarStyle) preferredStatusBarStyle
{
#if defined (__IPHONE_13_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
if (@available (iOS 13.0, *))
{
if (auto* peer = getViewPeer (self))
@ -677,7 +658,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
}
}
}
#endif
return UIStatusBarStyleDefault;
}
@ -747,7 +727,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
[self addSubview: owner->hiddenTextInput.get()];
#if JUCE_HAS_IOS_POINTER_SUPPORT
if (@available (iOS 13.4, *))
{
auto hoverRecognizer = [[[UIHoverGestureRecognizer alloc] initWithTarget: self action: @selector (onHover:)] autorelease];
@ -762,7 +741,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
[panRecognizer setMaximumNumberOfTouches: 0];
[self addGestureRecognizer: panRecognizer];
}
#endif
return self;
}
@ -867,7 +845,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
[self touchesEnded: touches withEvent: event];
}
#if JUCE_HAS_IOS_POINTER_SUPPORT
- (void) onHover: (UIHoverGestureRecognizer*) gesture
{
if (owner != nullptr)
@ -879,7 +856,6 @@ MultiTouchMapper<UITouch*> UIViewComponentPeer::currentTouches;
if (owner != nullptr)
owner->onScroll (gesture);
}
#endif
static std::optional<int> getKeyCodeForSpecialCharacterString (StringRef characters)
{
@ -892,14 +868,10 @@ static std::optional<int> getKeyCodeForSpecialCharacterString (StringRef charact
{ nsStringToJuce (UIKeyInputLeftArrow), KeyPress::leftKey },
{ nsStringToJuce (UIKeyInputRightArrow), KeyPress::rightKey },
{ nsStringToJuce (UIKeyInputEscape), KeyPress::escapeKey },
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
// These symbols are available on iOS 8, but only declared in the headers for iOS 13.4+
{ nsStringToJuce (UIKeyInputPageUp), KeyPress::pageUpKey },
{ nsStringToJuce (UIKeyInputPageDown), KeyPress::pageDownKey },
#endif
};
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
if (@available (iOS 13.4, *))
{
result.insert ({ { nsStringToJuce (UIKeyInputHome), KeyPress::homeKey },
@ -917,7 +889,6 @@ static std::optional<int> getKeyCodeForSpecialCharacterString (StringRef charact
{ nsStringToJuce (UIKeyInputF11), KeyPress::F11Key },
{ nsStringToJuce (UIKeyInputF12), KeyPress::F12Key } });
}
#endif
#if defined (__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
if (@available (iOS 15.0, *))
@ -943,7 +914,6 @@ static int getKeyCodeForCharacters (NSString* characters)
return getKeyCodeForCharacters (nsStringToJuce (characters));
}
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
static void updateModifiers (const UIKeyModifierFlags flags)
{
const auto convert = [&flags] (UIKeyModifierFlags f, int result) { return (flags & f) != 0 ? result : 0; };
@ -1051,7 +1021,6 @@ static bool doKeysUp (UIViewComponentPeer* owner, NSSet<UIPress*>* presses, UIPr
if (! doKeysUp (owner, presses, event))
[super pressesCancelled: presses withEvent: event];
}
#endif
//==============================================================================
- (BOOL) becomeFirstResponder
@ -1720,13 +1689,9 @@ namespace juce
bool KeyPress::isKeyCurrentlyDown (int keyCode)
{
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
return iOSGlobals::keysCurrentlyDown.isDown (keyCode)
|| ('A' <= keyCode && keyCode <= 'Z' && iOSGlobals::keysCurrentlyDown.isDown ((int) CharacterFunctions::toLowerCase ((juce_wchar) keyCode)))
|| ('a' <= keyCode && keyCode <= 'z' && iOSGlobals::keysCurrentlyDown.isDown ((int) CharacterFunctions::toUpperCase ((juce_wchar) keyCode)));
#else
return false;
#endif
}
Point<float> juce_lastMousePos;
@ -1804,10 +1769,8 @@ UIViewComponentPeer::~UIViewComponentPeer()
{
[((JuceUIWindow*) window) setOwner: nil];
#if defined (__IPHONE_13_0)
if (@available (iOS 13.0, *))
window.windowScene = nil;
#endif
[window release];
}
@ -2012,12 +1975,10 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, MouseEventFlags mouseEv
if (event == nullptr)
return;
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
if (@available (iOS 13.4, *))
{
updateModifiers ([event modifierFlags]);
}
#endif
NSArray* touches = [[event touchesForView: view] allObjects];
@ -2096,7 +2057,6 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, MouseEventFlags mouseEv
}
}
#if JUCE_HAS_IOS_POINTER_SUPPORT
void UIViewComponentPeer::onHover (UIHoverGestureRecognizer* gesture)
{
auto pos = convertToPointFloat ([gesture locationInView: view]);
@ -2129,7 +2089,6 @@ void UIViewComponentPeer::onScroll (UIPanGestureRecognizer* gesture)
UIViewComponentPeer::getMouseTime ([[NSProcessInfo processInfo] systemUptime]),
details);
}
#endif
//==============================================================================
void UIViewComponentPeer::viewFocusGain()