diff options
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/README.md | 2 | ||||
-rw-r--r-- | platform/macos/detect.py | 1 | ||||
-rw-r--r-- | platform/macos/display_server_macos.h | 1 | ||||
-rw-r--r-- | platform/macos/display_server_macos.mm | 34 | ||||
-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 |
9 files changed, 41 insertions, 16 deletions
diff --git a/platform/macos/README.md b/platform/macos/README.md index feead80736..205c59e05d 100644 --- a/platform/macos/README.md +++ b/platform/macos/README.md @@ -11,7 +11,7 @@ packaging macOS export templates. ## Documentation -- [Compiling for macOS](https://docs.godotengine.org/en/latest/development/compiling/compiling_for_macos.html) +- [Compiling for macOS](https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_macos.html) - Instructions on building this platform port from source. - [Exporting for macOS](https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_macos.html) - Instructions on using the compiled export templates to export a project. 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/display_server_macos.h b/platform/macos/display_server_macos.h index 7f57644a4c..4873db4b64 100644 --- a/platform/macos/display_server_macos.h +++ b/platform/macos/display_server_macos.h @@ -114,6 +114,7 @@ public: bool resize_disabled = false; bool no_focus = false; bool is_popup = false; + bool mpass = false; Rect2i parent_safe_rect; }; diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 865b8d9711..d992467042 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -2974,6 +2974,9 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win case WINDOW_FLAG_NO_FOCUS: { wd.no_focus = p_enabled; } break; + case WINDOW_FLAG_MOUSE_PASSTHROUGH: { + wd.mpass = p_enabled; + } break; case WINDOW_FLAG_POPUP: { ERR_FAIL_COND_MSG(p_window == MAIN_WINDOW_ID, "Main window can't be popup."); ERR_FAIL_COND_MSG([wd.window_object isVisible] && (wd.is_popup != p_enabled), "Popup flag can't changed while window is opened."); @@ -3013,6 +3016,9 @@ bool DisplayServerMacOS::window_get_flag(WindowFlags p_flag, WindowID p_window) case WINDOW_FLAG_NO_FOCUS: { return wd.no_focus; } break; + case WINDOW_FLAG_MOUSE_PASSTHROUGH: { + return wd.mpass; + } break; case WINDOW_FLAG_POPUP: { return wd.is_popup; } break; @@ -3487,7 +3493,11 @@ void DisplayServerMacOS::process_events() { for (KeyValue<WindowID, WindowData> &E : windows) { WindowData &wd = E.value; - if (wd.mpath.size() > 0) { + if (wd.mpass) { + if (![wd.window_object ignoresMouseEvents]) { + [wd.window_object setIgnoresMouseEvents:YES]; + } + } else if (wd.mpath.size() > 0) { update_mouse_pos(wd, [wd.window_object mouseLocationOutsideOfEventStream]); if (Geometry2D::is_point_in_polygon(wd.mouse_pos, wd.mpath)) { if ([wd.window_object ignoresMouseEvents]) { @@ -3597,18 +3607,18 @@ DisplayServer *DisplayServerMacOS::create_func(const String &p_rendering_driver, } else { executable_command = vformat("open %s --args --rendering-driver opengl3", OS::get_singleton()->get_bundle_resource_dir().path_join("../..").simplify_path()); } - OS::get_singleton()->alert("Your video card driver does not support the selected Vulkan version.\n" - "Please try updating your GPU driver or try using the OpenGL 3 driver.\n" - "You can enable the OpenGL 3 driver by starting the engine from the\n" - "command line with the command: '" + - executable_command + "'.\n" - "If you have updated your graphics drivers recently, try rebooting.", - "Unable to initialize Video driver"); + OS::get_singleton()->alert( + vformat("Your video card drivers seem not to support the required Vulkan version.\n\n" + "If possible, consider updating your macOS version or using the OpenGL 3 driver.\n\n" + "You can enable the OpenGL 3 driver by starting the engine from the\n" + "command line with the command:\n'%s'", + executable_command), + "Unable to initialize Vulkan video driver"); } else { - OS::get_singleton()->alert("Your video card driver does not support the selected OpenGL version.\n" - "Please try updating your GPU driver.\n" - "If you have updated your graphics drivers recently, try rebooting.", - "Unable to initialize Video driver"); + OS::get_singleton()->alert( + "Your video card drivers seem not to support the required OpenGL 3.3 version.\n\n" + "If possible, consider updating your macOS version.", + "Unable to initialize OpenGL video driver"); } } return ds; 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. |