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

This commit is contained in:
bruvzg 2023-01-20 11:31:07 +02:00
parent 28a24639c3
commit aecfd92ea8
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
6 changed files with 17 additions and 3 deletions

View File

@ -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"])

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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.