summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/dir_access_macos.h5
-rw-r--r--platform/macos/dir_access_macos.mm2
-rw-r--r--platform/macos/display_server_macos.mm14
-rw-r--r--platform/macos/export/codesign.h6
-rw-r--r--platform/macos/export/export_plugin.cpp10
-rw-r--r--platform/macos/export/export_plugin.h4
-rw-r--r--platform/macos/export/lipo.h6
-rw-r--r--platform/macos/export/macho.h6
-rw-r--r--platform/macos/export/plist.h6
-rw-r--r--platform/macos/gl_manager_macos_legacy.h1
-rw-r--r--platform/macos/godot_content_view.mm2
-rw-r--r--platform/macos/godot_window.h2
-rw-r--r--platform/macos/godot_window_delegate.h2
-rw-r--r--platform/macos/godot_window_delegate.mm4
-rw-r--r--platform/macos/macos_terminal_logger.h1
-rw-r--r--platform/macos/os_macos.h4
-rw-r--r--platform/macos/os_macos.mm74
-rw-r--r--platform/macos/vulkan_context_macos.h6
18 files changed, 117 insertions, 38 deletions
diff --git a/platform/macos/dir_access_macos.h b/platform/macos/dir_access_macos.h
index 2b234ad96c..1ac1b995de 100644
--- a/platform/macos/dir_access_macos.h
+++ b/platform/macos/dir_access_macos.h
@@ -51,5 +51,6 @@ protected:
virtual bool is_hidden(const String &p_name);
};
-#endif //UNIX ENABLED
-#endif
+#endif // UNIX ENABLED || LIBC_FILEIO_ENABLED
+
+#endif // DIR_ACCESS_MACOS_H
diff --git a/platform/macos/dir_access_macos.mm b/platform/macos/dir_access_macos.mm
index 8f3906c6b8..94d937a7dc 100644
--- a/platform/macos/dir_access_macos.mm
+++ b/platform/macos/dir_access_macos.mm
@@ -78,4 +78,4 @@ bool DirAccessMacOS::is_hidden(const String &p_name) {
return [hidden boolValue];
}
-#endif //posix_enabled
+#endif // UNIX_ENABLED || LIBC_FILEIO_ENABLED
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index 07ba5d7497..b9bc182dde 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -334,7 +334,7 @@ void DisplayServerMacOS::_dispatch_input_event(const Ref<InputEvent> &p_event) {
if (windows.has(E->get())) {
Callable callable = windows[E->get()].input_event_callback;
if (callable.is_valid()) {
- callable.call((const Variant **)&evp, 1, ret, ce);
+ callable.callp((const Variant **)&evp, 1, ret, ce);
}
}
in_dispatch_input_event = false;
@@ -348,7 +348,7 @@ void DisplayServerMacOS::_dispatch_input_event(const Ref<InputEvent> &p_event) {
if (windows.has(event_from_window->get_window_id())) {
Callable callable = windows[event_from_window->get_window_id()].input_event_callback;
if (callable.is_valid()) {
- callable.call((const Variant **)&evp, 1, ret, ce);
+ callable.callp((const Variant **)&evp, 1, ret, ce);
}
}
} else {
@@ -356,7 +356,7 @@ void DisplayServerMacOS::_dispatch_input_event(const Ref<InputEvent> &p_event) {
for (KeyValue<WindowID, WindowData> &E : windows) {
Callable callable = E.value.input_event_callback;
if (callable.is_valid()) {
- callable.call((const Variant **)&evp, 1, ret, ce);
+ callable.callp((const Variant **)&evp, 1, ret, ce);
}
}
}
@@ -555,7 +555,7 @@ void DisplayServerMacOS::menu_callback(id p_sender) {
Variant *tagp = &tag;
Variant ret;
Callable::CallError ce;
- value->callback.call((const Variant **)&tagp, 1, ret, ce);
+ value->callback.callp((const Variant **)&tagp, 1, ret, ce);
}
}
}
@@ -596,7 +596,7 @@ void DisplayServerMacOS::send_window_event(const WindowData &wd, WindowEvent p_e
Variant *eventp = &event;
Variant ret;
Callable::CallError ce;
- wd.event_callback.call((const Variant **)&eventp, 1, ret, ce);
+ wd.event_callback.callp((const Variant **)&eventp, 1, ret, ce);
}
}
@@ -1522,7 +1522,7 @@ Error DisplayServerMacOS::dialog_show(String p_title, String p_description, Vect
Variant *buttonp = &button;
Variant ret;
Callable::CallError ce;
- p_callback.call((const Variant **)&buttonp, 1, ret, ce);
+ p_callback.callp((const Variant **)&buttonp, 1, ret, ce);
}
return OK;
@@ -1554,7 +1554,7 @@ Error DisplayServerMacOS::dialog_input_text(String p_title, String p_description
Variant *textp = &text;
Variant ret;
Callable::CallError ce;
- p_callback.call((const Variant **)&textp, 1, ret, ce);
+ p_callback.callp((const Variant **)&textp, 1, ret, ce);
}
return OK;
diff --git a/platform/macos/export/codesign.h b/platform/macos/export/codesign.h
index 3a08c0ea86..fea7b117d0 100644
--- a/platform/macos/export/codesign.h
+++ b/platform/macos/export/codesign.h
@@ -38,8 +38,8 @@
// - Requirements code generator is not implemented (only hard-coded requirements for the ad-hoc signing is supported).
// - RFC5652/CMS blob generation is not implemented, supports ad-hoc signing only.
-#ifndef CODESIGN_H
-#define CODESIGN_H
+#ifndef MACOS_CODESIGN_H
+#define MACOS_CODESIGN_H
#include "core/crypto/crypto_core.h"
#include "core/io/dir_access.h"
@@ -365,4 +365,4 @@ public:
#endif // MODULE_REGEX_ENABLED
-#endif // CODESIGN_H
+#endif // MACOS_CODESIGN_H
diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp
index 8cb69997d9..fd0781ac50 100644
--- a/platform/macos/export/export_plugin.cpp
+++ b/platform/macos/export/export_plugin.cpp
@@ -766,7 +766,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
int ret = unzGoToFirstFile(src_pkg_zip);
- String binary_to_use = "godot_macos_" + String(p_debug ? "debug" : "release") + ".64";
+ String binary_to_use = "godot_macos_" + String(p_debug ? "debug" : "release") + ".universal";
String pkg_name;
if (String(ProjectSettings::get_singleton()->get("application/config/name")) != "") {
@@ -1064,19 +1064,19 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
}
if (data.size() > 0) {
- if (file.find("/data.mono.macos.64.release_debug/") != -1) {
+ if (file.find("/data.mono.macos.release_debug.universal/") != -1) {
if (!p_debug) {
ret = unzGoToNextFile(src_pkg_zip);
continue; // skip
}
- file = file.replace("/data.mono.macos.64.release_debug/", "/GodotSharp/");
+ file = file.replace("/data.mono.macos.release_debug.universal/", "/GodotSharp/");
}
- if (file.find("/data.mono.macos.64.release/") != -1) {
+ if (file.find("/data.mono.macos.release.universal/") != -1) {
if (p_debug) {
ret = unzGoToNextFile(src_pkg_zip);
continue; // skip
}
- file = file.replace("/data.mono.macos.64.release/", "/GodotSharp/");
+ file = file.replace("/data.mono.macos.release.universal/", "/GodotSharp/");
}
if (file.ends_with(".dylib")) {
diff --git a/platform/macos/export/export_plugin.h b/platform/macos/export/export_plugin.h
index 410ec22545..4f4b17594c 100644
--- a/platform/macos/export/export_plugin.h
+++ b/platform/macos/export/export_plugin.h
@@ -39,8 +39,8 @@
#include "core/io/zip_io.h"
#include "core/os/os.h"
#include "core/version.h"
-#include "editor/editor_export.h"
#include "editor/editor_settings.h"
+#include "editor/export/editor_export.h"
#include "platform/macos/logo.gen.h"
#include <sys/stat.h>
@@ -134,4 +134,4 @@ public:
~EditorExportPlatformMacOS();
};
-#endif
+#endif // MACOS_EXPORT_PLUGIN_H
diff --git a/platform/macos/export/lipo.h b/platform/macos/export/lipo.h
index 0e419be17e..516ef99860 100644
--- a/platform/macos/export/lipo.h
+++ b/platform/macos/export/lipo.h
@@ -30,8 +30,8 @@
// Universal / Universal 2 fat binary file creator and extractor.
-#ifndef LIPO_H
-#define LIPO_H
+#ifndef MACOS_LIPO_H
+#define MACOS_LIPO_H
#include "core/io/file_access.h"
#include "core/object/ref_counted.h"
@@ -73,4 +73,4 @@ public:
#endif // MODULE_REGEX_ENABLED
-#endif // LIPO_H
+#endif // MACOS_LIPO_H
diff --git a/platform/macos/export/macho.h b/platform/macos/export/macho.h
index 6cfc3c44f5..7ef0d9067e 100644
--- a/platform/macos/export/macho.h
+++ b/platform/macos/export/macho.h
@@ -30,8 +30,8 @@
// Mach-O binary object file format parser and editor.
-#ifndef MACHO_H
-#define MACHO_H
+#ifndef MACOS_MACHO_H
+#define MACOS_MACHO_H
#include "core/crypto/crypto.h"
#include "core/crypto/crypto_core.h"
@@ -212,4 +212,4 @@ public:
#endif // MODULE_REGEX_ENABLED
-#endif // MACHO_H
+#endif // MACOS_MACHO_H
diff --git a/platform/macos/export/plist.h b/platform/macos/export/plist.h
index ba9eaec196..79cb928d0a 100644
--- a/platform/macos/export/plist.h
+++ b/platform/macos/export/plist.h
@@ -30,8 +30,8 @@
// Property list file format (application/x-plist) parser, property list ASN-1 serialization.
-#ifndef PLIST_H
-#define PLIST_H
+#ifndef MACOS_PLIST_H
+#define MACOS_PLIST_H
#include "core/crypto/crypto_core.h"
#include "core/io/file_access.h"
@@ -113,4 +113,4 @@ public:
#endif // MODULE_REGEX_ENABLED
-#endif // PLIST_H
+#endif // MACOS_PLIST_H
diff --git a/platform/macos/gl_manager_macos_legacy.h b/platform/macos/gl_manager_macos_legacy.h
index 9f866f2b32..8752086551 100644
--- a/platform/macos/gl_manager_macos_legacy.h
+++ b/platform/macos/gl_manager_macos_legacy.h
@@ -94,4 +94,5 @@ public:
};
#endif // MACOS_ENABLED && GLES3_ENABLED
+
#endif // GL_MANAGER_MACOS_LEGACY_H
diff --git a/platform/macos/godot_content_view.mm b/platform/macos/godot_content_view.mm
index 9ca7498a15..dbed969901 100644
--- a/platform/macos/godot_content_view.mm
+++ b/platform/macos/godot_content_view.mm
@@ -267,7 +267,7 @@
Variant *vp = &v;
Variant ret;
Callable::CallError ce;
- wd.drop_files_callback.call((const Variant **)&vp, 1, ret, ce);
+ wd.drop_files_callback.callp((const Variant **)&vp, 1, ret, ce);
}
return NO;
diff --git a/platform/macos/godot_window.h b/platform/macos/godot_window.h
index 16ff101142..9fc5599e86 100644
--- a/platform/macos/godot_window.h
+++ b/platform/macos/godot_window.h
@@ -44,4 +44,4 @@
@end
-#endif //GODOT_WINDOW_H
+#endif // GODOT_WINDOW_H
diff --git a/platform/macos/godot_window_delegate.h b/platform/macos/godot_window_delegate.h
index 8a1f681fcd..98c226aa2f 100644
--- a/platform/macos/godot_window_delegate.h
+++ b/platform/macos/godot_window_delegate.h
@@ -44,4 +44,4 @@
@end
-#endif //GODOT_WINDOW_DELEGATE_H
+#endif // GODOT_WINDOW_DELEGATE_H
diff --git a/platform/macos/godot_window_delegate.mm b/platform/macos/godot_window_delegate.mm
index e1e88274f0..2d9329ab3c 100644
--- a/platform/macos/godot_window_delegate.mm
+++ b/platform/macos/godot_window_delegate.mm
@@ -187,7 +187,7 @@
Variant *sizep = &size;
Variant ret;
Callable::CallError ce;
- wd.rect_changed_callback.call((const Variant **)&sizep, 1, ret, ce);
+ wd.rect_changed_callback.callp((const Variant **)&sizep, 1, ret, ce);
}
}
@@ -205,7 +205,7 @@
Variant *sizep = &size;
Variant ret;
Callable::CallError ce;
- wd.rect_changed_callback.call((const Variant **)&sizep, 1, ret, ce);
+ wd.rect_changed_callback.callp((const Variant **)&sizep, 1, ret, ce);
}
}
diff --git a/platform/macos/macos_terminal_logger.h b/platform/macos/macos_terminal_logger.h
index bad2c1d657..a811a5cbaf 100644
--- a/platform/macos/macos_terminal_logger.h
+++ b/platform/macos/macos_terminal_logger.h
@@ -41,4 +41,5 @@ public:
};
#endif // MACOS_ENABLED
+
#endif // MACOS_TERMINAL_LOGGER_H
diff --git a/platform/macos/os_macos.h b/platform/macos/os_macos.h
index 914cdb9af7..a1eb0f7f69 100644
--- a/platform/macos/os_macos.h
+++ b/platform/macos/os_macos.h
@@ -97,6 +97,8 @@ public:
virtual String get_locale() const override;
+ virtual Vector<String> get_system_fonts() const override;
+ virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override;
virtual String get_executable_path() const override;
virtual Error create_process(const String &p_path, const List<String> &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) override;
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) override;
@@ -117,4 +119,4 @@ public:
~OS_MacOS();
};
-#endif
+#endif // OS_MACOS_H
diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm
index 2c6cd7de0b..cc550043de 100644
--- a/platform/macos/os_macos.mm
+++ b/platform/macos/os_macos.mm
@@ -303,6 +303,80 @@ String OS_MacOS::get_locale() const {
return String([locale_code UTF8String]).replace("-", "_");
}
+Vector<String> OS_MacOS::get_system_fonts() const {
+ HashSet<String> font_names;
+ CFArrayRef fonts = CTFontManagerCopyAvailableFontFamilyNames();
+ if (fonts) {
+ for (CFIndex i = 0; i < CFArrayGetCount(fonts); i++) {
+ CFStringRef cf_name = (CFStringRef)CFArrayGetValueAtIndex(fonts, i);
+ if (cf_name && (CFStringGetLength(cf_name) > 0) && (CFStringCompare(cf_name, CFSTR("LastResort"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) && (CFStringGetCharacterAtIndex(cf_name, 0) != '.')) {
+ NSString *ns_name = (__bridge NSString *)cf_name;
+ font_names.insert(String::utf8([ns_name UTF8String]));
+ }
+ }
+ CFRelease(fonts);
+ }
+
+ Vector<String> ret;
+ for (const String &E : font_names) {
+ ret.push_back(E);
+ }
+ return ret;
+}
+
+String OS_MacOS::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const {
+ String ret;
+
+ String font_name = p_font_name;
+ if (font_name.to_lower() == "sans-serif") {
+ font_name = "Helvetica";
+ } else if (font_name.to_lower() == "serif") {
+ font_name = "Times";
+ } else if (font_name.to_lower() == "monospace") {
+ font_name = "Courier";
+ } else if (font_name.to_lower() == "fantasy") {
+ font_name = "Papyrus";
+ } else if (font_name.to_lower() == "cursive") {
+ font_name = "Apple Chancery";
+ };
+
+ CFStringRef name = CFStringCreateWithCString(kCFAllocatorDefault, font_name.utf8().get_data(), kCFStringEncodingUTF8);
+
+ CTFontSymbolicTraits traits = 0;
+ if (p_bold) {
+ traits |= kCTFontBoldTrait;
+ }
+ if (p_italic) {
+ traits |= kCTFontItalicTrait;
+ }
+
+ CFNumberRef sym_traits = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &traits);
+ CFMutableDictionaryRef traits_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr);
+ CFDictionaryAddValue(traits_dict, kCTFontSymbolicTrait, sym_traits);
+
+ CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, nullptr, nullptr);
+ CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, name);
+ CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traits_dict);
+
+ CTFontDescriptorRef font = CTFontDescriptorCreateWithAttributes(attributes);
+ if (font) {
+ CFURLRef url = (CFURLRef)CTFontDescriptorCopyAttribute(font, kCTFontURLAttribute);
+ if (url) {
+ NSString *font_path = [NSString stringWithString:[(__bridge NSURL *)url path]];
+ ret = String::utf8([font_path UTF8String]);
+ CFRelease(url);
+ }
+ CFRelease(font);
+ }
+
+ CFRelease(attributes);
+ CFRelease(traits_dict);
+ CFRelease(sym_traits);
+ CFRelease(name);
+
+ return ret;
+}
+
String OS_MacOS::get_executable_path() const {
char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
int pid = getpid();
diff --git a/platform/macos/vulkan_context_macos.h b/platform/macos/vulkan_context_macos.h
index 4dc6a12756..579c42b042 100644
--- a/platform/macos/vulkan_context_macos.h
+++ b/platform/macos/vulkan_context_macos.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef VULKAN_DEVICE_MACOS_H
-#define VULKAN_DEVICE_MACOS_H
+#ifndef VULKAN_CONTEXT_MACOS_H
+#define VULKAN_CONTEXT_MACOS_H
#include "drivers/vulkan/vulkan_context.h"
#import <AppKit/AppKit.h>
@@ -44,4 +44,4 @@ public:
~VulkanContextMacOS();
};
-#endif // VULKAN_DEVICE_MACOS_H
+#endif // VULKAN_CONTEXT_MACOS_H