diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/display_server_android.cpp | 13 | ||||
-rw-r--r-- | platform/android/os_android.cpp | 16 | ||||
-rw-r--r-- | platform/ios/display_server_ios.mm | 25 | ||||
-rw-r--r-- | platform/linuxbsd/x11/display_server_x11.cpp | 24 | ||||
-rw-r--r-- | platform/macos/display_server_macos.mm | 22 | ||||
-rw-r--r-- | platform/web/display_server_web.cpp | 6 | ||||
-rw-r--r-- | platform/web/os_web.cpp | 18 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 38 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 13 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 3 |
10 files changed, 103 insertions, 75 deletions
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index 780ad4334e..6b3bdb7fe6 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -466,14 +466,15 @@ Vector<String> DisplayServerAndroid::get_rendering_drivers_func() { DisplayServer *DisplayServerAndroid::create_func(const String &p_rendering_driver, DisplayServer::WindowMode p_mode, DisplayServer::VSyncMode p_vsync_mode, uint32_t p_flags, const Vector2i *p_position, const Vector2i &p_resolution, int p_screen, Error &r_error) { DisplayServer *ds = memnew(DisplayServerAndroid(p_rendering_driver, p_mode, p_vsync_mode, p_flags, p_position, p_resolution, p_screen, r_error)); if (r_error != OK) { - OS::get_singleton()->alert("Your video card driver does not support any of the supported Vulkan versions.", "Unable to initialize Video driver"); if (p_rendering_driver == "vulkan") { - OS::get_singleton()->alert("Your video card driver does not support the selected Vulkan version.\n" - "Please try exporting your game using the gl_compatibility renderer.", - "Unable to initialize Video driver"); + OS::get_singleton()->alert( + "Your device seems not to support the required Vulkan version.\n\n" + "Please try exporting your game using the 'gl_compatibility' renderer.", + "Unable to initialize Vulkan video driver"); } else { - OS::get_singleton()->alert("Your video card driver does not support OpenGL ES 3.0.", - "Unable to initialize Video driver"); + OS::get_singleton()->alert( + "Your device seems not to support the required OpenGL ES 3.0 version.", + "Unable to initialize OpenGL video driver"); } } return ds; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 376ed89c16..942bf0a904 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -355,20 +355,20 @@ void OS_Android::_load_system_font_config() { if (parser->get_node_type() == XMLParser::NODE_ELEMENT) { in_font_node = false; if (parser->get_node_name() == "familyset") { - int ver = parser->has_attribute("version") ? parser->get_attribute_value("version").to_int() : 0; + int ver = parser->has_attribute("version") ? parser->get_named_attribute_value("version").to_int() : 0; if (ver < 21) { ERR_PRINT(vformat("Unsupported font config version %s", ver)); break; } } else if (parser->get_node_name() == "alias") { - String name = parser->has_attribute("name") ? parser->get_attribute_value("name").strip_edges() : String(); - String to = parser->has_attribute("to") ? parser->get_attribute_value("to").strip_edges() : String(); + String name = parser->has_attribute("name") ? parser->get_named_attribute_value("name").strip_edges() : String(); + String to = parser->has_attribute("to") ? parser->get_named_attribute_value("to").strip_edges() : String(); if (!name.is_empty() && !to.is_empty()) { font_aliases[name] = to; } } else if (parser->get_node_name() == "family") { - fn = parser->has_attribute("name") ? parser->get_attribute_value("name").strip_edges() : String(); - String lang_code = parser->has_attribute("lang") ? parser->get_attribute_value("lang").strip_edges() : String(); + fn = parser->has_attribute("name") ? parser->get_named_attribute_value("name").strip_edges() : String(); + String lang_code = parser->has_attribute("lang") ? parser->get_named_attribute_value("lang").strip_edges() : String(); Vector<String> lang_codes = lang_code.split(","); for (int i = 0; i < lang_codes.size(); i++) { Vector<String> lang_code_elements = lang_codes[i].split("-"); @@ -412,9 +412,9 @@ void OS_Android::_load_system_font_config() { } } else if (parser->get_node_name() == "font") { in_font_node = true; - fb = parser->has_attribute("fallbackFor") ? parser->get_attribute_value("fallbackFor").strip_edges() : String(); - fi.weight = parser->has_attribute("weight") ? parser->get_attribute_value("weight").to_int() : 400; - fi.italic = parser->has_attribute("style") && parser->get_attribute_value("style").strip_edges() == "italic"; + fb = parser->has_attribute("fallbackFor") ? parser->get_named_attribute_value("fallbackFor").strip_edges() : String(); + fi.weight = parser->has_attribute("weight") ? parser->get_named_attribute_value("weight").to_int() : 400; + fi.italic = parser->has_attribute("style") && parser->get_named_attribute_value("style").strip_edges() == "italic"; } } if (parser->get_node_type() == XMLParser::NODE_TEXT) { diff --git a/platform/ios/display_server_ios.mm b/platform/ios/display_server_ios.mm index bea88a7f9b..86ea602a98 100644 --- a/platform/ios/display_server_ios.mm +++ b/platform/ios/display_server_ios.mm @@ -56,16 +56,9 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode tts = [[TTS_IOS alloc] init]; #if defined(GLES3_ENABLED) - // FIXME: Add support for both OpenGL and Vulkan when OpenGL is implemented - // again, - // Note that we should be checking "opengl3" as the driver, might never enable this seeing OpenGL is deprecated on iOS - // We are hardcoding the rendering_driver to "vulkan" down below - if (rendering_driver == "opengl3") { bool gl_initialization_error = false; - // FIXME: Add Vulkan support via MoltenVK. Add fallback code back? - if (RasterizerGLES3::is_viable() == OK) { RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); @@ -74,22 +67,10 @@ DisplayServerIOS::DisplayServerIOS(const String &p_rendering_driver, WindowMode } if (gl_initialization_error) { - OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.", "Unable to initialize video driver"); - // return ERR_UNAVAILABLE; + OS::get_singleton()->alert( + "Your device seems not to support the required OpenGL ES 3.0 version.\n\n", + "Unable to initialize OpenGL video driver"); } - - // rendering_server = memnew(RenderingServerDefault); - // // FIXME: Reimplement threaded rendering - // if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { - // rendering_server = memnew(RenderingServerWrapMT(rendering_server, - // false)); - // } - // rendering_server->init(); - // rendering_server->cursor_set_visible(false, 0); - - // reset this to what it should be, it will have been set to 0 after - // rendering_server->init() is called - // RasterizerStorageGLES3system_fbo = gl_view_base_fb; } #endif diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 2cb00728c8..d4f82cc81e 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -4576,18 +4576,20 @@ DisplayServer *DisplayServerX11::create_func(const String &p_rendering_driver, W if (r_error != OK) { if (p_rendering_driver == "vulkan") { String executable_name = OS::get_singleton()->get_executable_path().get_file(); - 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:\n'./" + - executable_name + " --rendering-driver opengl3'.\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 video card drivers 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 --rendering-driver opengl3'\n\n" + "If you recently updated your video card drivers, try rebooting.", + executable_name), + "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 video card drivers.\n\n" + "If you recently updated your video card drivers, try rebooting.", + "Unable to initialize OpenGL video driver"); } } return ds; diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 63280c7887..d992467042 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -3607,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/web/display_server_web.cpp b/platform/web/display_server_web.cpp index 7dd0515d3f..fdb9d107a7 100644 --- a/platform/web/display_server_web.cpp +++ b/platform/web/display_server_web.cpp @@ -787,8 +787,10 @@ DisplayServerWeb::DisplayServerWeb(const String &p_rendering_driver, WindowMode RasterizerGLES3::make_current(); } else { - OS::get_singleton()->alert("Your browser does not seem to support WebGL2. Please update your browser version.", - "Unable to initialize video driver"); + OS::get_singleton()->alert( + "Your browser seems not to support WebGL 2.\n\n" + "If possible, consider updating your browser version and video card drivers.", + "Unable to initialize WebGL 2 video driver"); RasterizerDummy::make_current(); } #else diff --git a/platform/web/os_web.cpp b/platform/web/os_web.cpp index e12f62f4ad..964bce01da 100644 --- a/platform/web/os_web.cpp +++ b/platform/web/os_web.cpp @@ -30,6 +30,7 @@ #include "os_web.h" +#include "core/config/project_settings.h" #include "core/debugger/engine_debugger.h" #include "drivers/unix/dir_access_unix.h" #include "drivers/unix/file_access_unix.h" @@ -157,7 +158,22 @@ void OS_Web::vibrate_handheld(int p_duration_ms) { } String OS_Web::get_user_data_dir() const { - return "/userfs"; + String userfs = "/userfs"; + String appname = get_safe_dir_name(GLOBAL_GET("application/config/name")); + if (!appname.is_empty()) { + bool use_custom_dir = GLOBAL_GET("application/config/use_custom_user_dir"); + if (use_custom_dir) { + String custom_dir = get_safe_dir_name(GLOBAL_GET("application/config/custom_user_dir_name"), true); + if (custom_dir.is_empty()) { + custom_dir = appname; + } + return userfs.path_join(custom_dir).replace("\\", "/"); + } else { + return userfs.path_join(get_godot_dir_name()).path_join("app_userdata").path_join(appname).replace("\\", "/"); + } + } + + return userfs.path_join(get_godot_dir_name()).path_join("app_userdata").path_join("[unnamed project]"); } String OS_Web::get_cache_path() const { diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 914cd07b50..631543763b 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -741,6 +741,17 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod if (p_flags & WINDOW_FLAG_POPUP_BIT) { wd.is_popup = true; } + if (p_flags & WINDOW_FLAG_TRANSPARENT_BIT) { + DWM_BLURBEHIND bb; + ZeroMemory(&bb, sizeof(bb)); + HRGN hRgn = CreateRectRgn(0, 0, -1, -1); + bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; + bb.hRgnBlur = hRgn; + bb.fEnable = TRUE; + DwmEnableBlurBehindWindow(wd.hWnd, &bb); + + wd.layered_window = true; + } // Inherit icons from MAIN_WINDOW for all sub windows. HICON mainwindow_icon = (HICON)SendMessage(windows[MAIN_WINDOW_ID].hWnd, WM_GETICON, ICON_SMALL, 0); @@ -778,6 +789,9 @@ void DisplayServerWindows::show_window(WindowID p_id) { SetForegroundWindow(wd.hWnd); // Slightly higher priority. SetFocus(wd.hWnd); // Set keyboard focus. } + if (wd.always_on_top) { + SetWindowPos(wd.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | ((wd.no_focus || wd.is_popup) ? SWP_NOACTIVATE : 0)); + } } void DisplayServerWindows::delete_sub_window(WindowID p_window) { @@ -4145,18 +4159,20 @@ DisplayServer *DisplayServerWindows::create_func(const String &p_rendering_drive if (r_error != OK) { if (p_rendering_driver == "vulkan") { String executable_name = OS::get_singleton()->get_executable_path().get_file(); - 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:\n'./" + - executable_name + " --rendering-driver opengl3'.\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 video card drivers 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 --rendering-driver opengl3'\n\n" + "If you have recently updated your video card drivers, try rebooting.", + executable_name), + "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 video card drivers.\n\n" + "If you have recently updated your video card drivers, try rebooting.", + "Unable to initialize OpenGL video driver"); } } return ds; diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index b3831573cf..130c5f7b97 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1166,8 +1166,17 @@ String OS_Windows::get_environment(const String &p_var) const { return ""; } -bool OS_Windows::set_environment(const String &p_var, const String &p_value) const { - return (bool)SetEnvironmentVariableW((LPCWSTR)(p_var.utf16().get_data()), (LPCWSTR)(p_value.utf16().get_data())); +void OS_Windows::set_environment(const String &p_var, const String &p_value) const { + ERR_FAIL_COND_MSG(p_var.is_empty() || p_var.contains("="), vformat("Invalid environment variable name '%s', cannot be empty or include '='.", p_var)); + Char16String var = p_var.utf16(); + Char16String value = p_value.utf16(); + ERR_FAIL_COND_MSG(var.length() + value.length() + 2 > 32767, vformat("Invalid definition for environment variable '%s', cannot exceed 32767 characters.", p_var)); + SetEnvironmentVariableW((LPCWSTR)(var.get_data()), (LPCWSTR)(value.get_data())); +} + +void OS_Windows::unset_environment(const String &p_var) const { + ERR_FAIL_COND_MSG(p_var.is_empty() || p_var.contains("="), vformat("Invalid environment variable name '%s', cannot be empty or include '='.", p_var)); + SetEnvironmentVariableW((LPCWSTR)(p_var.utf16().get_data()), nullptr); // Null to delete. } String OS_Windows::get_stdin_string() { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index c33e0f6740..05110c2614 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -186,7 +186,8 @@ public: virtual bool has_environment(const String &p_var) const override; virtual String get_environment(const String &p_var) const override; - virtual bool set_environment(const String &p_var, const String &p_value) const override; + virtual void set_environment(const String &p_var, const String &p_value) const override; + virtual void unset_environment(const String &p_var) const override; virtual Vector<String> get_system_fonts() const override; virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; |