diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-20 11:31:07 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-01-20 11:31:07 +0200 |
commit | aecfd92ea81f0c3024cff56139c908ce97cdc115 (patch) | |
tree | 6099c258f6c14277bda4c992830b9f2901d0c71e | |
parent | 28a24639c3c6a95b5b9828f5f02bf0dc2f5ce54b (diff) |
[macOS] Move `Wno-deprecated-declarations` to pragmas in the OpenGL related files, update some deprecated code.
-rw-r--r-- | platform/macos/detect.py | 1 | ||||
-rw-r--r-- | platform/macos/gl_manager_macos_legacy.h | 5 | ||||
-rw-r--r-- | platform/macos/gl_manager_macos_legacy.mm | 5 | ||||
-rw-r--r-- | platform/macos/godot_content_view.h | 5 | ||||
-rw-r--r-- | platform/macos/godot_menu_delegate.mm | 2 | ||||
-rw-r--r-- | platform/macos/joypad_macos.cpp | 2 |
6 files changed, 17 insertions, 3 deletions
diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 67e4b49b14..14e6e92bfa 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -231,7 +231,6 @@ def configure(env: "Environment"): if env["opengl3"]: env.Append(CPPDEFINES=["GLES_ENABLED", "GLES3_ENABLED"]) - env.Append(CCFLAGS=["-Wno-deprecated-declarations"]) # Disable deprecation warnings env.Append(LINKFLAGS=["-framework", "OpenGL"]) env.Append(LINKFLAGS=["-rpath", "@executable_path/../Frameworks", "-rpath", "@executable_path"]) diff --git a/platform/macos/gl_manager_macos_legacy.h b/platform/macos/gl_manager_macos_legacy.h index 663bc5ea7b..c33b803d81 100644 --- a/platform/macos/gl_manager_macos_legacy.h +++ b/platform/macos/gl_manager_macos_legacy.h @@ -33,6 +33,9 @@ #if defined(MACOS_ENABLED) && defined(GLES3_ENABLED) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14 + #include "core/error/error_list.h" #include "core/os/os.h" #include "core/templates/local_vector.h" @@ -95,6 +98,8 @@ public: ~GLManager_MacOS(); }; +#pragma clang diagnostic push + #endif // MACOS_ENABLED && GLES3_ENABLED #endif // GL_MANAGER_MACOS_LEGACY_H diff --git a/platform/macos/gl_manager_macos_legacy.mm b/platform/macos/gl_manager_macos_legacy.mm index a53b737289..65e978bfe6 100644 --- a/platform/macos/gl_manager_macos_legacy.mm +++ b/platform/macos/gl_manager_macos_legacy.mm @@ -33,6 +33,9 @@ #ifdef MACOS_ENABLED #ifdef GLES3_ENABLED +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14 + #include <stdio.h> #include <stdlib.h> @@ -232,5 +235,7 @@ GLManager_MacOS::~GLManager_MacOS() { release_current(); } +#pragma clang diagnostic pop + #endif // GLES3_ENABLED #endif // MACOS_ENABLED diff --git a/platform/macos/godot_content_view.h b/platform/macos/godot_content_view.h index ba7f15c32b..e660285e49 100644 --- a/platform/macos/godot_content_view.h +++ b/platform/macos/godot_content_view.h @@ -53,6 +53,9 @@ @end +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // OpenGL is deprecated in macOS 10.14 + @interface GodotContentView : RootView <NSTextInputClient> { DisplayServer::WindowID window_id; NSTrackingArea *tracking_area; @@ -73,4 +76,6 @@ @end +#pragma clang diagnostic pop + #endif // GODOT_CONTENT_VIEW_H diff --git a/platform/macos/godot_menu_delegate.mm b/platform/macos/godot_menu_delegate.mm index 02cfca0841..ebfe8b1f6d 100644 --- a/platform/macos/godot_menu_delegate.mm +++ b/platform/macos/godot_menu_delegate.mm @@ -41,7 +41,7 @@ - (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action { NSString *ev_key = [[event charactersIgnoringModifiers] lowercaseString]; - NSUInteger ev_modifiers = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask; + NSUInteger ev_modifiers = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask; for (int i = 0; i < [menu numberOfItems]; i++) { const NSMenuItem *menu_item = [menu itemAtIndex:i]; if ([menu_item isEnabled] && [[menu_item keyEquivalent] compare:ev_key] == NSOrderedSame) { diff --git a/platform/macos/joypad_macos.cpp b/platform/macos/joypad_macos.cpp index b7b8e0604c..1fcd636a4b 100644 --- a/platform/macos/joypad_macos.cpp +++ b/platform/macos/joypad_macos.cpp @@ -316,7 +316,7 @@ bool JoypadMacOS::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { if (vendor && product_id) { char uid[128]; - sprintf(uid, "%08x%08x%08x%08x", OSSwapHostToBigInt32(3), OSSwapHostToBigInt32(vendor), OSSwapHostToBigInt32(product_id), OSSwapHostToBigInt32(version)); + snprintf(uid, 128, "%08x%08x%08x%08x", OSSwapHostToBigInt32(3), OSSwapHostToBigInt32(vendor), OSSwapHostToBigInt32(product_id), OSSwapHostToBigInt32(version)); input->joy_connection_changed(id, true, name, uid); } else { // Bluetooth device. |