Explorar el Código

[macOS] Move `Wno-deprecated-declarations` to pragmas in the OpenGL related files, update some deprecated code.

bruvzg hace 2 años
padre
commit
aecfd92ea8

+ 0 - 1
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"])

+ 5 - 0
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

+ 5 - 0
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

+ 5 - 0
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

+ 1 - 1
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) {

+ 1 - 1
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.