From 2c35ba6a364b3d24e879376698c59d914dc7330a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 2 Aug 2022 19:48:03 +0200 Subject: [PATCH] darwin: Remove unneeded SDK version checks for older versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit eb774dfc7b3e4cbaeab41f345612ae079361141b) Reviewed-by: Tor Arne Vestbø --- mkspecs/common/macx.conf | 2 +- src/corelib/kernel/qcore_mac.mm | 4 ---- src/gui/platform/darwin/qapplekeymapper.mm | 2 -- src/plugins/platforms/cocoa/qcocoatheme.mm | 14 -------------- src/plugins/platforms/ios/quiview.mm | 4 ---- src/plugins/styles/mac/qmacstyle_mac.mm | 4 ---- src/plugins/tls/securetransport/qtls_st.cpp | 4 ---- 7 files changed, 1 insertion(+), 33 deletions(-) diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf index b5427dd88cd..2c1c90fd2b7 100644 --- a/mkspecs/common/macx.conf +++ b/mkspecs/common/macx.conf @@ -7,7 +7,7 @@ QMAKE_MAC_SDK = macosx 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 diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm index b18a7d56efe..f424f92400a 100644 --- a/src/corelib/kernel/qcore_mac.mm +++ b/src/corelib/kernel/qcore_mac.mm @@ -335,13 +335,11 @@ QDebug operator<<(QDebug debug, const QCFString &string) #ifdef Q_OS_MACOS bool qt_mac_applicationIsInDarkMode() { -#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) if (__builtin_available(macOS 10.14, *)) { auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames: @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]]; return [appearance isEqualToString:NSAppearanceNameDarkAqua]; } -#endif 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) { auto versionCommand = reinterpret_cast(loadCommand); 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) { auto versionCommand = reinterpret_cast(loadCommand); return makeVersionTuple(versionCommand->minos, versionCommand->sdk, osForPlatform(versionCommand->platform)); -#endif } commandCursor += loadCommand->cmdsize; } diff --git a/src/gui/platform/darwin/qapplekeymapper.mm b/src/gui/platform/darwin/qapplekeymapper.mm index dcc51bfca62..2b0335fef46 100644 --- a/src/gui/platform/darwin/qapplekeymapper.mm +++ b/src/gui/platform/darwin/qapplekeymapper.mm @@ -601,7 +601,6 @@ QList QAppleKeyMapper::possibleKeys(const QKeyEvent *event) const API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode) { static QHash uiKitKeys = { -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4) { UIKeyInputF1, Qt::Key_F1 }, { UIKeyInputF2, Qt::Key_F2 }, { UIKeyInputF3, Qt::Key_F3 }, @@ -618,7 +617,6 @@ API_AVAILABLE(ios(13.4)) Qt::Key QAppleKeyMapper::fromUIKitKey(NSString *keyCode { UIKeyInputEnd, Qt::Key_End }, { UIKeyInputPageUp, Qt::Key_PageUp }, { UIKeyInputPageDown, Qt::Key_PageDown }, -#endif { UIKeyInputEscape, Qt::Key_Escape }, { UIKeyInputUpArrow, Qt::Key_Up }, { UIKeyInputDownArrow, Qt::Key_Down }, diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 408c9ac4038..52f8259f31a 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -33,18 +33,6 @@ #include -#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 *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 static QPalette *qt_mac_createSystemPalette() @@ -241,7 +229,6 @@ const char *QCocoaTheme::name = "cocoa"; QCocoaTheme::QCocoaTheme() : m_systemPalette(nullptr) { -#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) { m_appearanceObserver = QMacKeyValueObserver(NSApp, @"effectiveAppearance", [this] { if (__builtin_available(macOS 10.14, *)) @@ -250,7 +237,6 @@ QCocoaTheme::QCocoaTheme() handleSystemThemeChange(); }); } -#endif m_systemColorObserver = QMacNotificationObserver(nil, NSSystemColorsDidChangeNotification, [this] { diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index 32f27587c6e..87fcd122622 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -558,7 +558,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") case UIPressTypeMenu: return Qt::Key_Menu; case UIPressTypePlayPause: return Qt::Key_MediaTogglePlayPause; } -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4) if (@available(ios 13.4, *)) { NSString *charactersIgnoringModifiers = press.key.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, charactersIgnoringModifiers, text); } -#endif return Qt::Key_unknown; } @@ -580,10 +578,8 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") bool handled = false; for (UIPress* press in presses) { Qt::KeyboardModifiers qtModifiers = Qt::NoModifier; -#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4) if (@available(ios 13.4, *)) qtModifiers = QAppleKeyMapper::fromUIKitModifiers(press.key.modifierFlags); -#endif QString text; int key = [self mapPressTypeToKey:press withModifiers:qtModifiers text:text]; if (key == Qt::Key_unknown) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index bc62d50d6da..0181e24eb2a 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -385,7 +385,6 @@ class AppearanceSync { public: AppearanceSync() { -#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave && !isDarkMode()) { auto requiredAppearanceName = NSApplication.sharedApplication.effectiveAppearance.name; @@ -394,7 +393,6 @@ public: NSAppearance.currentAppearance = [NSAppearance appearanceNamed:requiredAppearanceName]; } } -#endif // QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) } ~AppearanceSync() @@ -2066,7 +2064,6 @@ QMacStyle::QMacStyle() QCoreApplication::sendEvent(o, &event); }); -#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14) Q_D(QMacStyle); // FIXME: Tie this logic into theme change, or even polish/unpolish if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave) { @@ -2077,7 +2074,6 @@ QMacStyle::QMacStyle() d->cocoaControls.clear(); }); } -#endif } QMacStyle::~QMacStyle() diff --git a/src/plugins/tls/securetransport/qtls_st.cpp b/src/plugins/tls/securetransport/qtls_st.cpp index d2e5132752c..5f3cf4d9a38 100644 --- a/src/plugins/tls/securetransport/qtls_st.cpp +++ b/src/plugins/tls/securetransport/qtls_st.cpp @@ -315,7 +315,6 @@ void TlsCryptographSecureTransport::continueHandshake() qCDebug(lcSecureTransport) << d->plainTcpSocket() << "connection encrypted"; #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 // 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. @@ -350,7 +349,6 @@ void TlsCryptographSecureTransport::continueHandshake() } } } -#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE if (!renegotiating) emit q->encrypted(); @@ -694,7 +692,6 @@ bool TlsCryptographSecureTransport::initSslContext() 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, *)) { const auto protocolNames = configuration.allowedNextProtocols(); QCFType cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks)); @@ -722,7 +719,6 @@ bool TlsCryptographSecureTransport::initSslContext() qCWarning(lcSecureTransport) << "failed to allocate ALPN names array"; } } -#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE if (mode == QSslSocket::SslClientMode) { // enable Server Name Indication (SNI)