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.

Pick-to: 6.4 6.3 6.2
Change-Id: I128321ec9e97b670b7c027f1233978e1b8856f88
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2022-08-02 19:48:03 +02:00
parent 29049d23f0
commit eb774dfc7b
7 changed files with 1 additions and 37 deletions

View File

@ -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

View File

@ -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<version_min_command *>(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<build_version_command *>(loadCommand);
return makeVersionTuple(versionCommand->minos, versionCommand->sdk, osForPlatform(versionCommand->platform));
#endif
}
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)
{
static QHash<NSString *, Qt::Key> 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 },

View File

@ -33,18 +33,6 @@
#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
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] {

View File

@ -72,11 +72,9 @@ Q_LOGGING_CATEGORY(lcQpaInputEvents, "qt.qpa.input.events")
// handled by the UIView. Scroll gestures, even those coming from touch devices,
// such as trackpads will still be received as they are not touch events
m_scrollGestureRecognizer.allowedTouchTypes = [NSArray array];
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
if (@available(ios 13.4, *)) {
m_scrollGestureRecognizer.allowedScrollTypesMask = UIScrollTypeMaskAll;
}
#endif
m_scrollGestureRecognizer.maximumNumberOfTouches = 0;
m_lastScrollDelta = CGPointZero;
m_lastScrollCursorPos = CGPointZero;
@ -580,7 +578,6 @@ Q_LOGGING_CATEGORY(lcQpaInputEvents, "qt.qpa.input.events")
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);
@ -589,7 +586,6 @@ Q_LOGGING_CATEGORY(lcQpaInputEvents, "qt.qpa.input.events")
return QAppleKeyMapper::fromNSString(qtModifiers, press.key.characters,
charactersIgnoringModifiers, text);
}
#endif
return Qt::Key_unknown;
}
@ -602,10 +598,8 @@ Q_LOGGING_CATEGORY(lcQpaInputEvents, "qt.qpa.input.events")
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)
@ -725,10 +719,8 @@ Q_LOGGING_CATEGORY(lcQpaInputEvents, "qt.qpa.input.events")
ulong qt_timestamp = time_stamp * 1000;
Qt::KeyboardModifiers qt_modifierFlags = Qt::NoModifier;
#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_13_4)
if (@available(ios 13.4, *))
qt_modifierFlags = QAppleKeyMapper::fromUIKitModifiers(recognizer.modifierFlags);
#endif
if (recognizer.state == UIGestureRecognizerStateBegan)
// locationInView: doesn't return the cursor position at the time of the wheel event,

View File

@ -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()

View File

@ -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<CFMutableArrayRef> 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)