darwin: Remove unneeded SDK version checks for older versions

All versions down to 6.2 require at least Xcode 12, which ships with
the macOS 11 SDK, and iOS 14 SDK.

Change-Id: I128321ec9e97b670b7c027f1233978e1b8856f88
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit eb774dfc7b3e4cbaeab41f345612ae079361141b)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-08-02 19:48:03 +02:00
parent 1a836a2abd
commit 2c35ba6a36
7 changed files with 1 additions and 33 deletions

View File

@ -7,7 +7,7 @@ QMAKE_MAC_SDK = macosx
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
QT_MAC_SDK_VERSION_MIN = 10.15 QT_MAC_SDK_VERSION_MIN = 11
QT_MAC_SDK_VERSION_MAX = 12 QT_MAC_SDK_VERSION_MAX = 12

View File

@ -335,13 +335,11 @@ QDebug operator<<(QDebug debug, const QCFString &string)
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
bool qt_mac_applicationIsInDarkMode() bool qt_mac_applicationIsInDarkMode()
{ {
#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
if (__builtin_available(macOS 10.14, *)) { 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];
} }
#endif
return false; return false;
} }
@ -711,11 +709,9 @@ QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machH
|| loadCommand->cmd == LC_VERSION_MIN_TVOS || loadCommand->cmd == LC_VERSION_MIN_WATCHOS) { || loadCommand->cmd == LC_VERSION_MIN_TVOS || loadCommand->cmd == LC_VERSION_MIN_WATCHOS) {
auto versionCommand = reinterpret_cast<version_min_command *>(loadCommand); auto versionCommand = reinterpret_cast<version_min_command *>(loadCommand);
return makeVersionTuple(versionCommand->version, versionCommand->sdk, osForLoadCommand(loadCommand->cmd)); return makeVersionTuple(versionCommand->version, versionCommand->sdk, osForLoadCommand(loadCommand->cmd));
#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
} else if (loadCommand->cmd == LC_BUILD_VERSION) { } else if (loadCommand->cmd == LC_BUILD_VERSION) {
auto versionCommand = reinterpret_cast<build_version_command *>(loadCommand); auto versionCommand = reinterpret_cast<build_version_command *>(loadCommand);
return makeVersionTuple(versionCommand->minos, versionCommand->sdk, osForPlatform(versionCommand->platform)); return makeVersionTuple(versionCommand->minos, versionCommand->sdk, osForPlatform(versionCommand->platform));
#endif
} }
commandCursor += loadCommand->cmdsize; commandCursor += loadCommand->cmdsize;
} }

View File

@ -601,7 +601,6 @@ QList<int> QAppleKeyMapper::possibleKeys(const QKeyEvent *event) const
API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode) API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode)
{ {
static QHash<NSString *, Qt::Key> uiKitKeys = { static QHash<NSString *, Qt::Key> uiKitKeys = {
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
{ UIKeyInputF1, Qt::Key_F1 }, { UIKeyInputF1, Qt::Key_F1 },
{ UIKeyInputF2, Qt::Key_F2 }, { UIKeyInputF2, Qt::Key_F2 },
{ UIKeyInputF3, Qt::Key_F3 }, { UIKeyInputF3, Qt::Key_F3 },
@ -618,7 +617,6 @@ API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode
{ UIKeyInputEnd, Qt::Key_End }, { UIKeyInputEnd, Qt::Key_End },
{ UIKeyInputPageUp, Qt::Key_PageUp }, { UIKeyInputPageUp, Qt::Key_PageUp },
{ UIKeyInputPageDown, Qt::Key_PageDown }, { UIKeyInputPageDown, Qt::Key_PageDown },
#endif
{ UIKeyInputEscape, Qt::Key_Escape }, { UIKeyInputEscape, Qt::Key_Escape },
{ UIKeyInputUpArrow, Qt::Key_Up }, { UIKeyInputUpArrow, Qt::Key_Up },
{ UIKeyInputDownArrow, Qt::Key_Down }, { UIKeyInputDownArrow, Qt::Key_Down },

View File

@ -33,18 +33,6 @@
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
@interface NSColor (MojaveForwardDeclarations)
@property (class, strong, readonly) NSColor *selectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedTextColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSColor *unemphasizedSelectedContentBackgroundColor NS_AVAILABLE_MAC(10_14);
@property (class, strong, readonly) NSArray<NSColor *> *alternatingContentBackgroundColors NS_AVAILABLE_MAC(10_14);
// Missing from non-Mojave SDKs, even if introduced in 10.10
@property (class, strong, readonly) NSColor *linkColor NS_AVAILABLE_MAC(10_10);
@end
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static QPalette *qt_mac_createSystemPalette() static QPalette *qt_mac_createSystemPalette()
@ -241,7 +229,6 @@ const char *QCocoaTheme::name = "cocoa";
QCocoaTheme::QCocoaTheme() QCocoaTheme::QCocoaTheme()
: m_systemPalette(nullptr) : m_systemPalette(nullptr)
{ {
#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
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, *)) if (__builtin_available(macOS 10.14, *))
@ -250,7 +237,6 @@ QCocoaTheme::QCocoaTheme()
handleSystemThemeChange(); handleSystemThemeChange();
}); });
} }
#endif
m_systemColorObserver = QMacNotificationObserver(nil, m_systemColorObserver = QMacNotificationObserver(nil,
NSSystemColorsDidChangeNotification, [this] { NSSystemColorsDidChangeNotification, [this] {

View File

@ -558,7 +558,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
case UIPressTypeMenu: return Qt::Key_Menu; case UIPressTypeMenu: return Qt::Key_Menu;
case UIPressTypePlayPause: return Qt::Key_MediaTogglePlayPause; case UIPressTypePlayPause: return Qt::Key_MediaTogglePlayPause;
} }
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
if (@available(ios 13.4, *)) { if (@available(ios 13.4, *)) {
NSString *charactersIgnoringModifiers = press.key.charactersIgnoringModifiers; NSString *charactersIgnoringModifiers = press.key.charactersIgnoringModifiers;
Qt::Key key = QAppleKeyMapper::fromUIKitKey(charactersIgnoringModifiers); Qt::Key key = QAppleKeyMapper::fromUIKitKey(charactersIgnoringModifiers);
@ -567,7 +566,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
return QAppleKeyMapper::fromNSString(qtModifiers, press.key.characters, return QAppleKeyMapper::fromNSString(qtModifiers, press.key.characters,
charactersIgnoringModifiers, text); charactersIgnoringModifiers, text);
} }
#endif
return Qt::Key_unknown; return Qt::Key_unknown;
} }
@ -580,10 +578,8 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
bool handled = false; bool handled = false;
for (UIPress* press in presses) { for (UIPress* press in presses) {
Qt::KeyboardModifiers qtModifiers = Qt::NoModifier; Qt::KeyboardModifiers qtModifiers = Qt::NoModifier;
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
if (@available(ios 13.4, *)) if (@available(ios 13.4, *))
qtModifiers = QAppleKeyMapper::fromUIKitModifiers(press.key.modifierFlags); qtModifiers = QAppleKeyMapper::fromUIKitModifiers(press.key.modifierFlags);
#endif
QString text; QString text;
int key = [self mapPressTypeToKey:press withModifiers:qtModifiers text:text]; int key = [self mapPressTypeToKey:press withModifiers:qtModifiers text:text];
if (key == Qt::Key_unknown) if (key == Qt::Key_unknown)

View File

@ -385,7 +385,6 @@ class AppearanceSync {
public: public:
AppearanceSync() AppearanceSync()
{ {
#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave
&& !isDarkMode()) { && !isDarkMode()) {
auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name; auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name;
@ -394,7 +393,6 @@ public:
NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName]; NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName];
} }
} }
#endif // QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
} }
~AppearanceSync() ~AppearanceSync()
@ -2066,7 +2064,6 @@ QMacStyle::QMacStyle()
QCoreApplication::sendEvent(o, &event); QCoreApplication::sendEvent(o, &event);
}); });
#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
Q_D(QMacStyle); Q_D(QMacStyle);
// FIXME: Tie this logic into theme change, or even polish/unpolish // FIXME: Tie this logic into theme change, or even polish/unpolish
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) { if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) {
@ -2077,7 +2074,6 @@ QMacStyle::QMacStyle()
d->cocoaControls.clear(); d->cocoaControls.clear();
}); });
} }
#endif
} }
QMacStyle::~QMacStyle() QMacStyle::~QMacStyle()

View File

@ -315,7 +315,6 @@ void TlsCryptographSecureTransport::continueHandshake()
qCDebug(lcSecureTransport) << d->plainTcpSocket() << "connection encrypted"; qCDebug(lcSecureTransport) << d->plainTcpSocket() << "connection encrypted";
#endif #endif
#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13_4, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
// Unlike OpenSSL, Secure Transport does not allow to negotiate protocols via // Unlike OpenSSL, Secure Transport does not allow to negotiate protocols via
// a callback during handshake. We can only set our list of preferred protocols // a callback during handshake. We can only set our list of preferred protocols
// (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.
@ -350,7 +349,6 @@ void TlsCryptographSecureTransport::continueHandshake()
} }
} }
} }
#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE
if (!renegotiating) if (!renegotiating)
emit q->encrypted(); emit q->encrypted();
@ -694,7 +692,6 @@ bool TlsCryptographSecureTransport::initSslContext()
return false; return false;
} }
#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_13_4, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
if (__builtin_available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)) { 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));
@ -722,7 +719,6 @@ bool TlsCryptographSecureTransport::initSslContext()
qCWarning(lcSecureTransport) << "failed to allocate ALPN names array"; qCWarning(lcSecureTransport) << "failed to allocate ALPN names array";
} }
} }
#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE
if (mode == QSslSocket::SslClientMode) { if (mode == QSslSocket::SslClientMode) {
// enable Server Name Indication (SNI) // enable Server Name Indication (SNI)