summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.11/qtbase-revert-no-macos10.10.patch
blob: e39934802cdf841372dd0fbf0d8811a93c27bec5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
Revert "Remove code paths for macOS < 10.11"

This reverts commit 138a65e0cfa80b13fd018a01e7d8b33341a3cfd3.

From 138a65e0cfa80b13fd018a01e7d8b33341a3cfd3 Mon Sep 17 00:00:00 2001
From: Jake Petroules <jake.petroules@qt.io>
Date: Thu, 8 Feb 2018 11:05:42 -0800
Subject: [PATCH] Remove code paths for macOS < 10.11
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: I5ae02d88aa3dcd97d1f2ebf6255a68643e5d6daa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
---
 .../fontdatabases/mac/qfontengine_coretext.mm            | 16 +++-------------
 src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm    |  6 +-----
 src/plugins/platforms/cocoa/qnswindowdelegate.mm         | 16 ----------------
 3 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 98b753ef..489d9cd0 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -47,18 +47,28 @@
 
 #include <cmath>
 
-#if defined(Q_OS_MACOS)
+#if defined(Q_OS_OSX) && !QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
 #import <AppKit/AppKit.h>
 #endif
 
-#if defined(QT_PLATFORM_UIKIT)
+#if defined(QT_PLATFORM_UIKIT) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2)
 #import <UIKit/UIKit.h>
 #endif
 
 // These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework,
 // but they are not documented and are not in public headers so are private API and exposed
 // only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857)
-#if defined(Q_OS_MACOS)
+#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_11, __IPHONE_8_2)
+#define kCTFontWeightUltraLight -0.8
+#define kCTFontWeightThin -0.6
+#define kCTFontWeightLight -0.4
+#define kCTFontWeightRegular 0
+#define kCTFontWeightMedium 0.23
+#define kCTFontWeightSemibold 0.3
+#define kCTFontWeightBold 0.4
+#define kCTFontWeightHeavy 0.56
+#define kCTFontWeightBlack 0.62
+#elif defined(Q_OS_OSX)
 #define kCTFontWeightUltraLight NSFontWeightUltraLight
 #define kCTFontWeightThin NSFontWeightThin
 #define kCTFontWeightLight NSFontWeightLight
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index 94f2125b..272cd9f3 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -162,7 +162,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
     // resetting our mCurrentDir, set the delegate
     // here to make sure it gets the correct value.
     [mSavePanel setDelegate:self];
-    mOpenPanel.accessoryViewDisclosed = YES;
+
+#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11)
+    if (__builtin_available(macOS 10.11, *))
+        mOpenPanel.accessoryViewDisclosed = YES;
+#endif
 
     if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept))
         [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]];
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 6e5623d6..cdecd86d 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -80,6 +80,22 @@ static QRegExp whitespaceRegex = QRegExp(QStringLiteral("\\s*"));
     return NSRectFromCGRect(m_cocoaWindow->screen()->availableGeometry().toCGRect());
 }
 
+#if QT_MACOS_DEPLOYMENT_TARGET_BELOW(__MAC_10_11)
+/*
+    AppKit on OS X 10.10 wrongly calls windowWillUseStandardFrame:defaultFrame
+    from -[NSWindow _frameForFullScreenMode] when going into fullscreen, resulting
+    in black bars on top and bottom of the window. By implementing the following
+    method, AppKit will choose that instead, and resolve the right fullscreen
+    geometry.
+*/
+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
+{
+    Q_UNUSED(proposedSize);
+    Q_ASSERT(window == m_cocoaWindow->nativeWindow());
+    return NSSizeFromCGSize(m_cocoaWindow->screen()->geometry().size().toCGSize());
+}
+#endif
+
 - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
 {
     Q_UNUSED(window);