diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/osx/export/export.cpp | 24 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 38 | ||||
-rw-r--r-- | platform/server/detect.py | 5 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 20 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 5 |
5 files changed, 70 insertions, 22 deletions
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 7985a241e4..edd093afbb 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -614,21 +614,27 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p bool EditorExportPlatformOSX::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { - bool valid = true; + bool valid = false; String err; - if (!exists_export_template("osx.zip", &err)) { - valid = false; + if (exists_export_template("osx.zip", &err)) { + valid = true; } - if (p_preset->get("custom_package/debug") != "" && !FileAccess::exists(p_preset->get("custom_package/debug"))) { - valid = false; - err += "Custom debug package not found.\n"; + if (p_preset->get("custom_package/debug") != "") { + if (FileAccess::exists(p_preset->get("custom_package/debug"))) { + valid = true; + } else { + err += "Custom debug package not found.\n"; + } } - if (p_preset->get("custom_package/release") != "" && !FileAccess::exists(p_preset->get("custom_package/release"))) { - valid = false; - err += "Custom release package not found.\n"; + if (p_preset->get("custom_package/release") != "") { + if (FileAccess::exists(p_preset->get("custom_package/release"))) { + valid = true; + } else { + err += "Custom release package not found.\n"; + } } if (!err.empty()) diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 901232bc50..f530da8b71 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -150,10 +150,44 @@ static Vector2 get_mouse_pos(NSEvent *event) { @end @interface GodotApplicationDelegate : NSObject +- (void)forceUnbundledWindowActivationHackStep1; +- (void)forceUnbundledWindowActivationHackStep2; +- (void)forceUnbundledWindowActivationHackStep3; @end @implementation GodotApplicationDelegate +- (void)forceUnbundledWindowActivationHackStep1 { + // Step1: Switch focus to macOS Dock. + // Required to perform step 2, TransformProcessType will fail if app is already the in focus. + for (NSRunningApplication *app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) { + [app activateWithOptions:NSApplicationActivateIgnoringOtherApps]; + break; + } + [self performSelector:@selector(forceUnbundledWindowActivationHackStep2) withObject:nil afterDelay:0.02]; +} + +- (void)forceUnbundledWindowActivationHackStep2 { + // Step 2: Register app as foreground process. + ProcessSerialNumber psn = { 0, kCurrentProcess }; + (void)TransformProcessType(&psn, kProcessTransformToForegroundApplication); + + [self performSelector:@selector(forceUnbundledWindowActivationHackStep3) withObject:nil afterDelay:0.02]; +} + +- (void)forceUnbundledWindowActivationHackStep3 { + // Step 3: Switch focus back to app window. + [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps]; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)notice { + NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; + if (nsappname == nil) { + // If executable is not a bundled, macOS WindowServer won't register and activate app window correctly (menu and title bar are grayed out and input ignored). + [self performSelector:@selector(forceUnbundledWindowActivationHackStep1) withObject:nil afterDelay:0.02]; + } +} + - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename { // Note: called before main loop init! char *utfs = strdup([filename UTF8String]); @@ -1181,8 +1215,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a /*** END OSX INITIALIZATION ***/ - bool use_gl2 = p_video_driver != 1; - AudioDriverManager::add_driver(&audio_driver); // only opengl support here... @@ -2342,7 +2374,7 @@ OS_OSX::OS_OSX() { NSMenuItem *menu_item; NSString *title; - NSString *nsappname = [[[NSBundle mainBundle] performSelector:@selector(localizedInfoDictionary)] objectForKey:@"CFBundleName"]; + NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; if (nsappname == nil) nsappname = [[NSProcessInfo processInfo] processName]; diff --git a/platform/server/detect.py b/platform/server/detect.py index c9a886ad6c..7bf445b43f 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -124,6 +124,11 @@ def configure(env): if not env['builtin_libogg']: env.ParseConfig('pkg-config ogg --cflags --libs') + # On Linux wchar_t should be 32-bits + # 16-bit library shouldn't be required due to compiler optimisations + if not env['builtin_pcre2']: + env.ParseConfig('pkg-config libpcre2-32 --cflags --libs') + ## Flags # Linkflags below this line should typically stay the last ones diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 76fc51d52c..0cdd0f338b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -78,19 +78,23 @@ #include <X11/XKBlib.h> int OS_X11::get_video_driver_count() const { - return 1; + + return 2; } const char *OS_X11::get_video_driver_name(int p_driver) const { - String driver_name = GLOBAL_GET("rendering/quality/driver/driver_name"); - if (driver_name == "GLES2") { - return "GLES2"; + switch (p_driver) { + case VIDEO_DRIVER_GLES2: + return "GLES2"; + case VIDEO_DRIVER_GLES3: + default: + return "GLES3"; } - return "GLES3"; } int OS_X11::get_audio_driver_count() const { + return AudioDriverManager::get_driver_count(); } @@ -289,13 +293,9 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a //print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height)); #if defined(OPENGL_ENABLED) - String setting_name = "rendering/quality/driver/driver_name"; - ProjectSettings::get_singleton()->set_custom_property_info(setting_name, PropertyInfo(Variant::STRING, setting_name, PROPERTY_HINT_ENUM, "GLES3,GLES2")); - String video_driver_name = GLOBAL_DEF("rendering/quality/driver/driver_name", "GLES3"); - ContextGL_X11::ContextType opengl_api_type = ContextGL_X11::GLES_3_0_COMPATIBLE; - if (video_driver_name == "GLES2") { + if (p_video_driver == VIDEO_DRIVER_GLES2) { opengl_api_type = ContextGL_X11::GLES_2_0_COMPATIBLE; } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 494845bc56..9aa742b0a7 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -53,6 +53,11 @@ #include <X11/extensions/XInput2.h> #endif +enum VideoDriver { + VIDEO_DRIVER_GLES3, + VIDEO_DRIVER_GLES2 +}; + // Hints for X11 fullscreen typedef struct { unsigned long flags; |