mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
UIViewComponentPeer: Fix deprecation warnings for iOS 17
This commit is contained in:
parent
128e258845
commit
f7c7225f5c
2 changed files with 33 additions and 3 deletions
|
|
@ -593,6 +593,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
JUCE_DEFINE_IOS_VERSION_CHECKER_FOR_VERSION (14, 0)
|
JUCE_DEFINE_IOS_VERSION_CHECKER_FOR_VERSION (14, 0)
|
||||||
|
JUCE_DEFINE_IOS_VERSION_CHECKER_FOR_VERSION (17, 0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1019,10 +1019,8 @@ static bool doKeysUp (UIViewComponentPeer* owner, NSSet<UIPress*>* presses, UIPr
|
||||||
return owner != nullptr && owner->canBecomeKeyWindow();
|
return owner != nullptr && owner->canBecomeKeyWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) traitCollectionDidChange: (UITraitCollection*) previousTraitCollection
|
static void postTraitChangeNotification (UITraitCollection* previousTraitCollection)
|
||||||
{
|
{
|
||||||
[super traitCollectionDidChange: previousTraitCollection];
|
|
||||||
|
|
||||||
const auto wasDarkModeActive = ([previousTraitCollection userInterfaceStyle] == UIUserInterfaceStyleDark);
|
const auto wasDarkModeActive = ([previousTraitCollection userInterfaceStyle] == UIUserInterfaceStyleDark);
|
||||||
|
|
||||||
if (wasDarkModeActive != Desktop::getInstance().isDarkModeActive())
|
if (wasDarkModeActive != Desktop::getInstance().isDarkModeActive())
|
||||||
|
|
@ -1030,6 +1028,18 @@ static bool doKeysUp (UIViewComponentPeer* owner, NSSet<UIPress*>* presses, UIPr
|
||||||
object: nil];
|
object: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ! defined (__IPHONE_17_0) || __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_17_0
|
||||||
|
- (void) traitCollectionDidChange: (UITraitCollection*) previousTraitCollection
|
||||||
|
{
|
||||||
|
[super traitCollectionDidChange: previousTraitCollection];
|
||||||
|
|
||||||
|
if (@available (ios 17, *))
|
||||||
|
{} // do nothing
|
||||||
|
else
|
||||||
|
postTraitChangeNotification (previousTraitCollection);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
- (BOOL) isAccessibilityElement
|
- (BOOL) isAccessibilityElement
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
|
@ -1671,6 +1681,23 @@ bool KeyPress::isKeyCurrentlyDown (int keyCode)
|
||||||
|
|
||||||
Point<float> juce_lastMousePos;
|
Point<float> juce_lastMousePos;
|
||||||
|
|
||||||
|
struct ChangeRegistrationTrait
|
||||||
|
{
|
||||||
|
#if defined (__IPHONE_17_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_17_0
|
||||||
|
API_AVAILABLE (ios (17))
|
||||||
|
static void newFn (UIView* view)
|
||||||
|
{
|
||||||
|
[view registerForTraitChanges: @[UITraitUserInterfaceStyle.self]
|
||||||
|
withHandler: ^(JuceUIView*, UITraitCollection* previousTraitCollection)
|
||||||
|
{
|
||||||
|
postTraitChangeNotification (previousTraitCollection);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void oldFn (UIView*) {}
|
||||||
|
};
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags, UIView* viewToAttachTo)
|
UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags, UIView* viewToAttachTo)
|
||||||
: ComponentPeer (comp, windowStyleFlags),
|
: ComponentPeer (comp, windowStyleFlags),
|
||||||
|
|
@ -1697,6 +1724,8 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags,
|
||||||
if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0)
|
if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0)
|
||||||
[[view layer] setDrawsAsynchronously: YES];
|
[[view layer] setDrawsAsynchronously: YES];
|
||||||
|
|
||||||
|
ifelse_17_0<ChangeRegistrationTrait> (view);
|
||||||
|
|
||||||
if (isSharedWindow)
|
if (isSharedWindow)
|
||||||
{
|
{
|
||||||
window = [viewToAttachTo window];
|
window = [viewToAttachTo window];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue