Remove unneeded @available check for macOS <= 10.14 and iOS <= 13
All versions down to Qt 6.2 require macOS 10.14 or iOS 13. Change-Id: I5048921ea5a149346a0fa84228227d9156004675 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 1e97a44e765a61305f3d8ffbca5d33c05008744c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
2c35ba6a36
commit
8d4411b8ec
@ -255,16 +255,9 @@ QMacAutoReleasePool::QMacAutoReleasePool()
|
|||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
void *poolFrame = nullptr;
|
void *poolFrame = nullptr;
|
||||||
if (__builtin_available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)) {
|
|
||||||
void *frame;
|
void *frame;
|
||||||
if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1))
|
if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1))
|
||||||
poolFrame = frame;
|
poolFrame = frame;
|
||||||
} else {
|
|
||||||
static const int maxFrames = 3;
|
|
||||||
void *callstack[maxFrames];
|
|
||||||
if (backtrace(callstack, maxFrames) == maxFrames)
|
|
||||||
poolFrame = callstack[maxFrames - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (poolFrame) {
|
if (poolFrame) {
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
@ -335,12 +328,9 @@ QDebug operator<<(QDebug debug, const QCFString &string)
|
|||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
bool qt_mac_applicationIsInDarkMode()
|
bool qt_mac_applicationIsInDarkMode()
|
||||||
{
|
{
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
|
||||||
auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames:
|
auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames:
|
||||||
@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
|
@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
|
||||||
return [appearance isEqualToString:NSAppearanceNameDarkAqua];
|
return [appearance isEqualToString:NSAppearanceNameDarkAqua];
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool qt_mac_runningUnderRosetta()
|
bool qt_mac_runningUnderRosetta()
|
||||||
@ -424,7 +414,6 @@ void qt_mac_ensureResponsible()
|
|||||||
|
|
||||||
CHECK_SPAWN(posix_spawnattr_setflags(&attr, flags));
|
CHECK_SPAWN(posix_spawnattr_setflags(&attr, flags));
|
||||||
|
|
||||||
if (@available(macOS 10.14, *))
|
|
||||||
CHECK_SPAWN(responsibility_spawnattrs_setdisclaim(&attr, 1));
|
CHECK_SPAWN(responsibility_spawnattrs_setdisclaim(&attr, 1));
|
||||||
|
|
||||||
char **argv = *_NSGetArgv();
|
char **argv = *_NSGetArgv();
|
||||||
|
@ -4169,7 +4169,6 @@ QSize QMetalSwapChain::surfacePixelSize()
|
|||||||
bool QMetalSwapChain::isFormatSupported(Format f)
|
bool QMetalSwapChain::isFormatSupported(Format f)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (@available(macOS 10.12, /*iOS 10.0,*/ *))
|
|
||||||
return f == SDR || f == HDRExtendedSrgbLinear;
|
return f == SDR || f == HDRExtendedSrgbLinear;
|
||||||
#endif
|
#endif
|
||||||
return f == SDR;
|
return f == SDR;
|
||||||
@ -4204,12 +4203,10 @@ void QMetalSwapChain::chooseFormats()
|
|||||||
samples = rhiD->effectiveSampleCount(m_sampleCount);
|
samples = rhiD->effectiveSampleCount(m_sampleCount);
|
||||||
// pick a format that is allowed for CAMetalLayer.pixelFormat
|
// pick a format that is allowed for CAMetalLayer.pixelFormat
|
||||||
if (m_format == HDRExtendedSrgbLinear) {
|
if (m_format == HDRExtendedSrgbLinear) {
|
||||||
if (@available(macOS 10.12, /*iOS 10.0,*/ *)) {
|
|
||||||
d->colorFormat = MTLPixelFormatRGBA16Float;
|
d->colorFormat = MTLPixelFormatRGBA16Float;
|
||||||
d->rhiColorFormat = QRhiTexture::RGBA16F;
|
d->rhiColorFormat = QRhiTexture::RGBA16F;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
d->colorFormat = m_flags.testFlag(sRGB) ? MTLPixelFormatBGRA8Unorm_sRGB : MTLPixelFormatBGRA8Unorm;
|
d->colorFormat = m_flags.testFlag(sRGB) ? MTLPixelFormatBGRA8Unorm_sRGB : MTLPixelFormatBGRA8Unorm;
|
||||||
d->rhiColorFormat = QRhiTexture::BGRA8;
|
d->rhiColorFormat = QRhiTexture::BGRA8;
|
||||||
}
|
}
|
||||||
@ -4242,12 +4239,11 @@ bool QMetalSwapChain::createOrResize()
|
|||||||
if (d->colorFormat != d->layer.pixelFormat)
|
if (d->colorFormat != d->layer.pixelFormat)
|
||||||
d->layer.pixelFormat = d->colorFormat;
|
d->layer.pixelFormat = d->colorFormat;
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
if (@available(macOS 10.12, /*iOS 10.0,*/ *)) { // Can't enable this on iOS until wantsExtendedDynamicRangeContent is available
|
// Can't enable this on iOS until wantsExtendedDynamicRangeContent is available
|
||||||
if (m_format == HDRExtendedSrgbLinear) {
|
if (m_format == HDRExtendedSrgbLinear) {
|
||||||
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
|
||||||
d->layer.wantsExtendedDynamicRangeContent = YES;
|
d->layer.wantsExtendedDynamicRangeContent = YES;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_flags.testFlag(UsedAsTransferSource))
|
if (m_flags.testFlag(UsedAsTransferSource))
|
||||||
|
@ -62,14 +62,9 @@ static QPalette *qt_mac_createSystemPalette()
|
|||||||
// System palette initialization:
|
// System palette initialization:
|
||||||
QBrush br = qt_mac_toQBrush([NSColor selectedControlColor]);
|
QBrush br = qt_mac_toQBrush([NSColor selectedControlColor]);
|
||||||
palette->setBrush(QPalette::Active, QPalette::Highlight, br);
|
palette->setBrush(QPalette::Active, QPalette::Highlight, br);
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
|
||||||
const auto inactiveHighlight = qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
|
const auto inactiveHighlight = qt_mac_toQBrush([NSColor unemphasizedSelectedContentBackgroundColor]);
|
||||||
palette->setBrush(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
|
palette->setBrush(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
|
||||||
palette->setBrush(QPalette::Disabled, QPalette::Highlight, inactiveHighlight);
|
palette->setBrush(QPalette::Disabled, QPalette::Highlight, inactiveHighlight);
|
||||||
} else {
|
|
||||||
palette->setBrush(QPalette::Inactive, QPalette::Highlight, br);
|
|
||||||
palette->setBrush(QPalette::Disabled, QPalette::Highlight, br);
|
|
||||||
}
|
|
||||||
|
|
||||||
palette->setBrush(QPalette::Shadow, qt_mac_toQColor([NSColor shadowColor]));
|
palette->setBrush(QPalette::Shadow, qt_mac_toQColor([NSColor shadowColor]));
|
||||||
|
|
||||||
@ -154,17 +149,8 @@ static QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
|
|||||||
}
|
}
|
||||||
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|
if (mac_widget_colors[i].paletteRole == QPlatformTheme::MenuPalette
|
||||||
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
|
|| mac_widget_colors[i].paletteRole == QPlatformTheme::MenuBarPalette) {
|
||||||
NSColor *selectedMenuItemColor = nil;
|
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
|
||||||
// Cheap approximation for NSVisualEffectView (see deprecation note for selectedMenuItemTextColor)
|
// Cheap approximation for NSVisualEffectView (see deprecation note for selectedMenuItemTextColor)
|
||||||
selectedMenuItemColor = [[NSColor controlAccentColor] highlightWithLevel:0.3];
|
auto selectedMenuItemColor = [[NSColor controlAccentColor] highlightWithLevel:0.3];
|
||||||
} else {
|
|
||||||
// selectedMenuItemColor would presumably be the correct color to use as the background
|
|
||||||
// for selected menu items. But that color is always blue, and doesn't follow the
|
|
||||||
// appearance color in system preferences. So we therefore deliberately choose to use
|
|
||||||
// keyboardFocusIndicatorColor instead, which appears to have the same color value.
|
|
||||||
selectedMenuItemColor = [NSColor keyboardFocusIndicatorColor];
|
|
||||||
}
|
|
||||||
pal.setBrush(QPalette::Highlight, qt_mac_toQColor(selectedMenuItemColor));
|
pal.setBrush(QPalette::Highlight, qt_mac_toQColor(selectedMenuItemColor));
|
||||||
qc = qt_mac_toQColor([NSColor labelColor]);
|
qc = qt_mac_toQColor([NSColor labelColor]);
|
||||||
pal.setBrush(QPalette::ButtonText, qc);
|
pal.setBrush(QPalette::ButtonText, qc);
|
||||||
@ -185,17 +171,10 @@ static QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
|
|||||||
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) {
|
} else if (mac_widget_colors[i].paletteRole == QPlatformTheme::ItemViewPalette) {
|
||||||
NSArray<NSColor *> *baseColors = nil;
|
NSArray<NSColor *> *baseColors = nil;
|
||||||
NSColor *activeHighlightColor = nil;
|
NSColor *activeHighlightColor = nil;
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
|
||||||
baseColors = [NSColor alternatingContentBackgroundColors];
|
baseColors = [NSColor alternatingContentBackgroundColors];
|
||||||
activeHighlightColor = [NSColor selectedContentBackgroundColor];
|
activeHighlightColor = [NSColor selectedContentBackgroundColor];
|
||||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
||||||
qt_mac_toQBrush([NSColor unemphasizedSelectedTextColor]));
|
qt_mac_toQBrush([NSColor unemphasizedSelectedTextColor]));
|
||||||
} else {
|
|
||||||
baseColors = [NSColor controlAlternatingRowBackgroundColors];
|
|
||||||
activeHighlightColor = [NSColor alternateSelectedControlColor];
|
|
||||||
pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
|
|
||||||
pal.brush(QPalette::Active, QPalette::Text));
|
|
||||||
}
|
|
||||||
pal.setBrush(QPalette::Base, qt_mac_toQBrush(baseColors[0]));
|
pal.setBrush(QPalette::Base, qt_mac_toQBrush(baseColors[0]));
|
||||||
pal.setBrush(QPalette::AlternateBase, qt_mac_toQBrush(baseColors[1]));
|
pal.setBrush(QPalette::AlternateBase, qt_mac_toQBrush(baseColors[1]));
|
||||||
pal.setBrush(QPalette::Active, QPalette::Highlight,
|
pal.setBrush(QPalette::Active, QPalette::Highlight,
|
||||||
@ -231,9 +210,7 @@ QCocoaTheme::QCocoaTheme()
|
|||||||
{
|
{
|
||||||
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) {
|
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) {
|
||||||
m_appearanceObserver = QMacKeyValueObserver(NSApp, @"effectiveAppearance", [this] {
|
m_appearanceObserver = QMacKeyValueObserver(NSApp, @"effectiveAppearance", [this] {
|
||||||
if (__builtin_available(macOS 10.14, *))
|
|
||||||
NSAppearance.currentAppearance = NSApp.effectiveAppearance;
|
NSAppearance.currentAppearance = NSApp.effectiveAppearance;
|
||||||
|
|
||||||
handleSystemThemeChange();
|
handleSystemThemeChange();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
if (m_fileDialog->options()->fileMode() == QFileDialogOptions::ExistingFiles)
|
if (m_fileDialog->options()->fileMode() == QFileDialogOptions::ExistingFiles)
|
||||||
self.allowsMultipleSelection = YES;
|
self.allowsMultipleSelection = YES;
|
||||||
|
|
||||||
if (@available(ios 13.0, *))
|
|
||||||
self.directoryURL = m_fileDialog->options()->initialDirectory().toNSURL();
|
self.directoryURL = m_fileDialog->options()->initialDirectory().toNSURL();
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
@ -177,14 +177,12 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
|
|||||||
{
|
{
|
||||||
[super traitCollectionDidChange:previousTraitCollection];
|
[super traitCollectionDidChange:previousTraitCollection];
|
||||||
|
|
||||||
if (@available(iOS 12, *)) {
|
|
||||||
if (self.screen == UIScreen.mainScreen) {
|
if (self.screen == UIScreen.mainScreen) {
|
||||||
if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
|
if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) {
|
||||||
QIOSTheme::initializeSystemPalette();
|
QIOSTheme::initializeSystemPalette();
|
||||||
QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
|
QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -49,7 +49,6 @@ void QIOSTheme::initializeSystemPalette()
|
|||||||
Q_DECL_IMPORT QPalette qt_fusionPalette(void);
|
Q_DECL_IMPORT QPalette qt_fusionPalette(void);
|
||||||
s_systemPalette = qt_fusionPalette();
|
s_systemPalette = qt_fusionPalette();
|
||||||
|
|
||||||
if (@available(ios 13.0, *)) {
|
|
||||||
s_systemPalette.setBrush(QPalette::Window, qt_mac_toQBrush(UIColor.systemGroupedBackgroundColor.CGColor));
|
s_systemPalette.setBrush(QPalette::Window, qt_mac_toQBrush(UIColor.systemGroupedBackgroundColor.CGColor));
|
||||||
s_systemPalette.setBrush(QPalette::Active, QPalette::WindowText, qt_mac_toQBrush(UIColor.labelColor.CGColor));
|
s_systemPalette.setBrush(QPalette::Active, QPalette::WindowText, qt_mac_toQBrush(UIColor.labelColor.CGColor));
|
||||||
|
|
||||||
@ -67,10 +66,6 @@ void QIOSTheme::initializeSystemPalette()
|
|||||||
|
|
||||||
s_systemPalette.setBrush(QPalette::Highlight, QColor(11, 70, 150, 60));
|
s_systemPalette.setBrush(QPalette::Highlight, QColor(11, 70, 150, 60));
|
||||||
s_systemPalette.setBrush(QPalette::HighlightedText, qt_mac_toQBrush(UIColor.labelColor.CGColor));
|
s_systemPalette.setBrush(QPalette::HighlightedText, qt_mac_toQBrush(UIColor.labelColor.CGColor));
|
||||||
} else {
|
|
||||||
s_systemPalette.setBrush(QPalette::Highlight, QColor(204, 221, 237));
|
|
||||||
s_systemPalette.setBrush(QPalette::HighlightedText, Qt::black);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPalette *QIOSTheme::palette(QPlatformTheme::Palette type) const
|
const QPalette *QIOSTheme::palette(QPlatformTheme::Palette type) const
|
||||||
@ -139,14 +134,12 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
|
|||||||
|
|
||||||
QPlatformTheme::Appearance QIOSTheme::appearance() const
|
QPlatformTheme::Appearance QIOSTheme::appearance() const
|
||||||
{
|
{
|
||||||
if (@available(ios 12, *)) {
|
|
||||||
if (UIWindow *window = qt_apple_sharedApplication().windows.lastObject) {
|
if (UIWindow *window = qt_apple_sharedApplication().windows.lastObject) {
|
||||||
return window.rootViewController.traitCollection.userInterfaceStyle
|
return window.rootViewController.traitCollection.userInterfaceStyle
|
||||||
== UIUserInterfaceStyleDark
|
== UIUserInterfaceStyleDark
|
||||||
? QPlatformTheme::Appearance::Dark
|
? QPlatformTheme::Appearance::Dark
|
||||||
: QPlatformTheme::Appearance::Light;
|
: QPlatformTheme::Appearance::Light;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return QPlatformTheme::Appearance::Unknown;
|
return QPlatformTheme::Appearance::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,15 +712,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
|||||||
|
|
||||||
+ (Class)layerClass
|
+ (Class)layerClass
|
||||||
{
|
{
|
||||||
#ifdef TARGET_IPHONE_SIMULATOR
|
|
||||||
if (@available(ios 13.0, *))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return [CAMetalLayer class];
|
return [CAMetalLayer class];
|
||||||
|
|
||||||
#ifdef TARGET_IPHONE_SIMULATOR
|
|
||||||
return nil;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1813,14 +1813,10 @@ NSView *QMacStylePrivate::cocoaControl(CocoaControl widget) const
|
|||||||
|| widget.size == QStyleHelper::SizeDefault)
|
|| widget.size == QStyleHelper::SizeDefault)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
if (widget.type == Box) {
|
if (widget.type == Box && isDarkMode()) {
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
|
||||||
if (isDarkMode()) {
|
|
||||||
// See render code in drawPrimitive(PE_FrameTabWidget)
|
// See render code in drawPrimitive(PE_FrameTabWidget)
|
||||||
widget.type = Box_Dark;
|
widget.type = Box_Dark;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSView *bv = cocoaControls.value(widget, nil);
|
NSView *bv = cocoaControls.value(widget, nil);
|
||||||
if (!bv) {
|
if (!bv) {
|
||||||
|
@ -320,7 +320,6 @@ void TlsCryptographSecureTransport::continueHandshake()
|
|||||||
// (and send it during handshake) and then receive what our peer has sent to us.
|
// (and send it during handshake) and then receive what our peer has sent to us.
|
||||||
// And here we can finally try to find a match (if any).
|
// And here we can finally try to find a match (if any).
|
||||||
const auto &configuration = q->sslConfiguration();
|
const auto &configuration = q->sslConfiguration();
|
||||||
if (__builtin_available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
|
|
||||||
const auto &requestedProtocols = configuration.allowedNextProtocols();
|
const auto &requestedProtocols = configuration.allowedNextProtocols();
|
||||||
if (const int requestedCount = requestedProtocols.size()) {
|
if (const int requestedCount = requestedProtocols.size()) {
|
||||||
QTlsBackend::setAlpnStatus(d, QSslConfiguration::NextProtocolNegotiationNone);
|
QTlsBackend::setAlpnStatus(d, QSslConfiguration::NextProtocolNegotiationNone);
|
||||||
@ -348,7 +347,6 @@ void TlsCryptographSecureTransport::continueHandshake()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!renegotiating)
|
if (!renegotiating)
|
||||||
emit q->encrypted();
|
emit q->encrypted();
|
||||||
@ -692,7 +690,6 @@ bool TlsCryptographSecureTransport::initSslContext()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__builtin_available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
|
|
||||||
const auto protocolNames = configuration.allowedNextProtocols();
|
const auto protocolNames = configuration.allowedNextProtocols();
|
||||||
QCFType<CFMutableArrayRef> cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks));
|
QCFType<CFMutableArrayRef> cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks));
|
||||||
if (cfNames) {
|
if (cfNames) {
|
||||||
@ -718,7 +715,6 @@ bool TlsCryptographSecureTransport::initSslContext()
|
|||||||
} else {
|
} else {
|
||||||
qCWarning(lcSecureTransport) << "failed to allocate ALPN names array";
|
qCWarning(lcSecureTransport) << "failed to allocate ALPN names array";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == QSslSocket::SslClientMode) {
|
if (mode == QSslSocket::SslClientMode) {
|
||||||
// enable Server Name Indication (SNI)
|
// enable Server Name Indication (SNI)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user