Merge pull request #23822 from bruvzg/mac_109_compat_ver_check

[macOS] Change runtime OS version checks to allow build with MacOS 10.9 SDK
This commit is contained in:
Rémi Verschelde 2018-11-20 14:01:02 +01:00 committed by GitHub
commit 7651b85782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 9 deletions

View File

@ -76,6 +76,13 @@
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
#endif
#ifndef NSAppKitVersionNumber10_12
#define NSAppKitVersionNumber10_12 1504
#endif
#ifndef NSAppKitVersionNumber10_14
#define NSAppKitVersionNumber10_14 1671
#endif
static void get_key_modifier_state(unsigned int p_osx_state, Ref<InputEventWithModifiers> state) {
state->set_shift((p_osx_state & NSEventModifierFlagShift));
@ -1237,7 +1244,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
ERR_FAIL_COND_V(window_object == nil, ERR_UNAVAILABLE);
window_view = [[GodotContentView alloc] init];
if (@available(macOS 10.14, *)) {
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_14) {
[window_view setWantsLayer:TRUE];
}
@ -1472,7 +1479,7 @@ public:
switch (p_type) {
case ERR_WARNING:
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_12) {
os_log_info(OS_LOG_DEFAULT,
"WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.",
p_function, err_details, p_file, p_line);
@ -1482,7 +1489,7 @@ public:
logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_SCRIPT:
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_12) {
os_log_error(OS_LOG_DEFAULT,
"SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
p_function, err_details, p_file, p_line);
@ -1492,7 +1499,7 @@ public:
logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_SHADER:
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_12) {
os_log_error(OS_LOG_DEFAULT,
"SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
p_function, err_details, p_file, p_line);
@ -1503,7 +1510,7 @@ public:
break;
case ERR_ERROR:
default:
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_12) {
os_log_error(OS_LOG_DEFAULT,
"ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
p_function, err_details, p_file, p_line);
@ -2174,11 +2181,7 @@ void OS_OSX::set_window_size(const Size2 p_size) {
if (menuBarHeight != 0.f) {
size.y += menuBarHeight;
} else {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12) {
#else
{
#endif
size.y += [[NSStatusBar systemStatusBar] thickness];
}
}