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

iOS: Fix build issues with Xcode 10.1

This commit is contained in:
reuk 2023-01-09 17:19:43 +00:00
parent 42bd861d70
commit f4f8f8e86b
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 19 additions and 12 deletions

View file

@ -701,12 +701,13 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
Image getIcon (int size)
{
#if TARGET_OS_MACCATALYST
if (@available (macCatalyst 14.0, *))
#endif
{
if (interAppAudioConnected)
{
UIImage* hostUIImage = AudioOutputUnitGetHostIcon (audioUnit, size);
if (hostUIImage != nullptr)
if (UIImage* hostUIImage = AudioOutputUnitGetHostIcon (audioUnit, size))
return juce_createImageFromUIImage (hostUIImage);
}
}

View file

@ -77,7 +77,6 @@ class UIViewComponentPeer;
namespace iOSGlobals
{
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
class KeysCurrentlyDown
{
public:
@ -95,7 +94,6 @@ private:
std::set<int> down;
};
static KeysCurrentlyDown keysCurrentlyDown;
#endif
static UIViewComponentPeer* currentlyFocusedPeer = nullptr;
} // namespace iOSGlobals
@ -797,13 +795,19 @@ static std::optional<int> getKeyCodeForSpecialCharacterString (StringRef charact
{
static const auto map = [&]
{
std::map<String, int> result { { nsStringToJuce (UIKeyInputUpArrow), KeyPress::upKey },
{ nsStringToJuce (UIKeyInputDownArrow), KeyPress::downKey },
{ nsStringToJuce (UIKeyInputLeftArrow), KeyPress::leftKey },
{ nsStringToJuce (UIKeyInputRightArrow), KeyPress::rightKey },
{ nsStringToJuce (UIKeyInputEscape), KeyPress::escapeKey },
{ nsStringToJuce (UIKeyInputPageUp), KeyPress::pageUpKey },
{ nsStringToJuce (UIKeyInputPageDown), KeyPress::pageDownKey } };
std::map<String, int> result
{
{ nsStringToJuce (UIKeyInputUpArrow), KeyPress::upKey },
{ nsStringToJuce (UIKeyInputDownArrow), KeyPress::downKey },
{ 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, *))
@ -839,7 +843,6 @@ static std::optional<int> getKeyCodeForSpecialCharacterString (StringRef charact
return iter != map.cend() ? std::make_optional (iter->second) : std::nullopt;
}
#if JUCE_HAS_IOS_HARDWARE_KEYBOARD_SUPPORT
static int getKeyCodeForCharacters (StringRef unmodified)
{
return getKeyCodeForSpecialCharacterString (unmodified).value_or (unmodified[0]);
@ -850,6 +853,7 @@ 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; };
@ -1920,10 +1924,12 @@ 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];