Skip to content

Commit 1218d75

Browse files
Deps: Add additional fixes for Mac OS 11 compat
why
1 parent 13dcad3 commit 1218d75

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

.github/workflows/scripts/macos/qt-macos11compat.patch

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
diff --git a/.cmake.conf b/.cmake.conf
2-
index 9a21ff42a74..d6707ba7dff 100644
32
--- a/.cmake.conf
43
+++ b/.cmake.conf
54
@@ -51,7 +51,7 @@ set(QT_MAX_NEW_POLICY_CMAKE_VERSION_QT_APPLE "3.21")
@@ -12,7 +11,6 @@ index 9a21ff42a74..d6707ba7dff 100644
1211

1312
set(QT_SUPPORTED_MIN_IOS_SDK_VERSION "17")
1413
diff --git a/CMakeLists.txt b/CMakeLists.txt
15-
index d3a14fc67eb..1553b956fe3 100644
1614
--- a/CMakeLists.txt
1715
+++ b/CMakeLists.txt
1816
@@ -12,6 +12,10 @@ cmake_minimum_required(VERSION 3.16)
@@ -27,7 +25,6 @@ index d3a14fc67eb..1553b956fe3 100644
2725

2826
qt_internal_check_if_path_has_symlinks("${CMAKE_BINARY_DIR}")
2927
diff --git a/src/corelib/global/qsysinfo.cpp b/src/corelib/global/qsysinfo.cpp
30-
index ae762c0cc6d..9171a5736b4 100644
3128
--- a/src/corelib/global/qsysinfo.cpp
3229
+++ b/src/corelib/global/qsysinfo.cpp
3330
@@ -1027,7 +1027,7 @@ QByteArray QSysInfo::machineUniqueId()
@@ -40,10 +37,9 @@ index ae762c0cc6d..9171a5736b4 100644
4037
CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman);
4138
return QByteArray(uuid);
4239
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm
43-
index 9f27dbe694e..c023a48cad3 100644
4440
--- a/src/corelib/kernel/qcore_mac.mm
4541
+++ b/src/corelib/kernel/qcore_mac.mm
46-
@@ -372,7 +372,7 @@ bool qt_apple_runningWithLiquidGlass()
42+
@@ -367,7 +367,7 @@ bool qt_apple_runningWithLiquidGlass()
4743
return config;
4844
#endif
4945

@@ -52,8 +48,50 @@ index 9f27dbe694e..c023a48cad3 100644
5248
if (!nvram) {
5349
qWarning("Failed to locate NVRAM entry in IO registry");
5450
return {};
51+
diff --git a/src/gui/platform/darwin/qappleiconengine.mm b/src/gui/platform/darwin/qappleiconengine.mm
52+
--- a/src/gui/platform/darwin/qappleiconengine.mm
53+
+++ b/src/gui/platform/darwin/qappleiconengine.mm
54+
@@ -366,12 +366,16 @@
55+
weight:NSFontWeightRegular
56+
scale:NSImageSymbolScaleLarge];
57+
58+
+ auto *primaryColor = [NSColor colorWithSRGBRed:color.redF()
59+
+ green:color.greenF()
60+
+ blue:color.blueF()
61+
+ alpha:color.alphaF()];
62+
+
63+
+ if (@available(macOS 13, *)) {
64+
+
65+
// Apply tint color first, which switches the configuration to palette mode
66+
config = [config configurationByApplyingConfiguration:
67+
- [NSImageSymbolConfiguration configurationWithPaletteColors:@[
68+
- [NSColor colorWithSRGBRed:color.redF() green:color.greenF()
69+
- blue:color.blueF() alpha:color.alphaF()]
70+
- ]]];
71+
+ [NSImageSymbolConfiguration configurationWithPaletteColors:@[primaryColor]]];
72+
73+
// Then switch back to monochrome, as palette mode gives a different look
74+
// than monochrome, even with a single color.
75+
@@ -379,6 +383,18 @@
76+
[NSImageSymbolConfiguration configurationPreferringMonochrome]];
77+
78+
return [image imageWithSymbolConfiguration:config];
79+
+
80+
+ } else {
81+
+ NSImage *configuredImage = [image imageWithSymbolConfiguration:config];
82+
+ return [NSImage imageWithSize:configuredImage.size flipped:NO
83+
+ drawingHandler:^BOOL(NSRect) {
84+
+ [primaryColor set];
85+
+ NSRect imageRect = {NSZeroPoint, configuredImage.size};
86+
+ [configuredImage drawInRect:imageRect];
87+
+ NSRectFillUsingOperation(imageRect, NSCompositingOperationSourceIn);
88+
+ return YES;
89+
+ }];
90+
+ }
91+
}
92+
#elif defined(QT_PLATFORM_UIKIT)
93+
auto *configuredImage(const UIImage *image, const QColor &color)
5594
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
56-
index 6b33d94d58c..867389e4c93 100644
5795
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
5896
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
5997
@@ -323,6 +323,8 @@ a normal (not maximized or full screen) top-level window.

0 commit comments

Comments
 (0)