diff options
Diffstat (limited to 'platform')
32 files changed, 137 insertions, 45 deletions
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index b0f16337ed..a7a8801bdc 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -164,7 +164,7 @@ int DisplayServerAndroid::screen_get_dpi(int p_screen) const { float DisplayServerAndroid::screen_get_refresh_rate(int p_screen) const { GodotIOJavaWrapper *godot_io_java = OS_Android::get_singleton()->get_godot_io_java(); if (!godot_io_java) { - ERR_PRINT("An error occured while trying to get the screen refresh rate."); + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); return SCREEN_REFRESH_RATE_FALLBACK; } diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index df2d32e152..464488967e 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -30,6 +30,8 @@ #include "export_plugin.h" +#include "editor/editor_node.h" + static const char *android_perms[] = { "ACCESS_CHECKIN_PROPERTIES", "ACCESS_COARSE_LOCATION", diff --git a/platform/android/export/export_plugin.h b/platform/android/export/export_plugin.h index 9e952ecb8f..c158a273d2 100644 --- a/platform/android/export/export_plugin.h +++ b/platform/android/export/export_plugin.h @@ -41,7 +41,6 @@ #include "drivers/png/png_driver_common.h" #include "editor/editor_export.h" #include "editor/editor_log.h" -#include "editor/editor_node.h" #include "editor/editor_settings.h" #include "main/splash.gen.h" #include "platform/android/logo.gen.h" diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index babd8173d0..9598d2f9fd 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -30,6 +30,8 @@ #include "gradle_export_util.h" +#include "core/config/project_settings.h" + int _get_android_orientation_value(DisplayServer::ScreenOrientation screen_orientation) { switch (screen_orientation) { case DisplayServer::SCREEN_PORTRAIT: diff --git a/platform/android/java_godot_io_wrapper.cpp b/platform/android/java_godot_io_wrapper.cpp index 8a2788e848..ff0bcf0716 100644 --- a/platform/android/java_godot_io_wrapper.cpp +++ b/platform/android/java_godot_io_wrapper.cpp @@ -141,12 +141,12 @@ float GodotIOJavaWrapper::get_screen_refresh_rate(float fallback) { if (_get_screen_refresh_rate) { JNIEnv *env = get_jni_env(); if (env == nullptr) { - ERR_PRINT("An error occured while trying to get screen refresh rate."); + ERR_PRINT("An error occurred while trying to get screen refresh rate."); return fallback; } return (float)env->CallDoubleMethod(godot_io_instance, _get_screen_refresh_rate, (double)fallback); } - ERR_PRINT("An error occured while trying to get the screen refresh rate."); + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); return fallback; } diff --git a/platform/iphone/export/export_plugin.cpp b/platform/iphone/export/export_plugin.cpp index 122e64d6a1..69c6df8a38 100644 --- a/platform/iphone/export/export_plugin.cpp +++ b/platform/iphone/export/export_plugin.cpp @@ -30,6 +30,8 @@ #include "export_plugin.h" +#include "editor/editor_node.h" + void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name"); // Vulkan and OpenGL ES 3.0 both mandate ETC2 support. diff --git a/platform/iphone/export/export_plugin.h b/platform/iphone/export/export_plugin.h index 93b23f7ee2..c01983e39f 100644 --- a/platform/iphone/export/export_plugin.h +++ b/platform/iphone/export/export_plugin.h @@ -41,7 +41,6 @@ #include "core/templates/safe_refcount.h" #include "core/version.h" #include "editor/editor_export.h" -#include "editor/editor_node.h" #include "editor/editor_settings.h" #include "main/splash.gen.h" #include "platform/iphone/logo.gen.h" diff --git a/platform/iphone/godot_view.h b/platform/iphone/godot_view.h index 1c72a26b4a..fcb97fa63a 100644 --- a/platform/iphone/godot_view.h +++ b/platform/iphone/godot_view.h @@ -59,4 +59,9 @@ class String; - (void)stopRendering; - (void)startRendering; +- (void)godotTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)godotTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)godotTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; +- (void)godotTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; + @end diff --git a/platform/iphone/godot_view.mm b/platform/iphone/godot_view.mm index b90c10fa84..ae92f32851 100644 --- a/platform/iphone/godot_view.mm +++ b/platform/iphone/godot_view.mm @@ -336,7 +336,7 @@ static const float earth_gravity = 9.80665; } } -- (void)touchesBegan:(NSSet *)touchesSet withEvent:(UIEvent *)event { +- (void)godotTouchesBegan:(NSSet *)touchesSet withEvent:(UIEvent *)event { NSArray *tlist = [event.allTouches allObjects]; for (unsigned int i = 0; i < [tlist count]; i++) { if ([touchesSet containsObject:[tlist objectAtIndex:i]]) { @@ -349,7 +349,7 @@ static const float earth_gravity = 9.80665; } } -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { +- (void)godotTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *tlist = [event.allTouches allObjects]; for (unsigned int i = 0; i < [tlist count]; i++) { if ([touches containsObject:[tlist objectAtIndex:i]]) { @@ -363,7 +363,7 @@ static const float earth_gravity = 9.80665; } } -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { +- (void)godotTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *tlist = [event.allTouches allObjects]; for (unsigned int i = 0; i < [tlist count]; i++) { if ([touches containsObject:[tlist objectAtIndex:i]]) { @@ -377,7 +377,7 @@ static const float earth_gravity = 9.80665; } } -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { +- (void)godotTouchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *tlist = [event.allTouches allObjects]; for (unsigned int i = 0; i < [tlist count]; i++) { if ([touches containsObject:[tlist objectAtIndex:i]]) { diff --git a/platform/iphone/godot_view_gesture_recognizer.mm b/platform/iphone/godot_view_gesture_recognizer.mm index b50ba5f942..a46c42765a 100644 --- a/platform/iphone/godot_view_gesture_recognizer.mm +++ b/platform/iphone/godot_view_gesture_recognizer.mm @@ -29,6 +29,7 @@ /*************************************************************************/ #import "godot_view_gesture_recognizer.h" +#import "godot_view.h" #include "core/config/project_settings.h" @@ -58,6 +59,10 @@ const CGFloat kGLGestureMovementDistance = 0.5; @implementation GodotViewGestureRecognizer +- (GodotView *)godotView { + return (GodotView *)self.view; +} + - (instancetype)init { self = [super init]; @@ -104,7 +109,7 @@ const CGFloat kGLGestureMovementDistance = 0.5; self.delayTimer = nil; if (self.delayedTouches) { - [self.view touchesBegan:self.delayedTouches withEvent:self.delayedEvent]; + [self.godotView godotTouchesBegan:self.delayedTouches withEvent:self.delayedEvent]; } self.delayedTouches = nil; @@ -114,6 +119,8 @@ const CGFloat kGLGestureMovementDistance = 0.5; - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSSet *cleared = [self copyClearedTouches:touches phase:UITouchPhaseBegan]; [self delayTouches:cleared andEvent:event]; + + [super touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { @@ -123,8 +130,8 @@ const CGFloat kGLGestureMovementDistance = 0.5; // We should check if movement was significant enough to fire an event // for dragging to work correctly. for (UITouch *touch in cleared) { - CGPoint from = [touch locationInView:self.view]; - CGPoint to = [touch previousLocationInView:self.view]; + CGPoint from = [touch locationInView:self.godotView]; + CGPoint to = [touch previousLocationInView:self.godotView]; CGFloat xDistance = from.x - to.x; CGFloat yDistance = from.y - to.y; @@ -133,7 +140,7 @@ const CGFloat kGLGestureMovementDistance = 0.5; // Early exit, since one of touches has moved enough to fire a drag event. if (distance > kGLGestureMovementDistance) { [self.delayTimer fire]; - [self.view touchesMoved:cleared withEvent:event]; + [self.godotView godotTouchesMoved:cleared withEvent:event]; return; } } @@ -141,26 +148,32 @@ const CGFloat kGLGestureMovementDistance = 0.5; return; } - [self.view touchesMoved:cleared withEvent:event]; + [self.godotView touchesMoved:cleared withEvent:event]; + + [super touchesMoved:touches withEvent:event]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [self.delayTimer fire]; NSSet *cleared = [self copyClearedTouches:touches phase:UITouchPhaseEnded]; - [self.view touchesEnded:cleared withEvent:event]; + [self.godotView godotTouchesEnded:cleared withEvent:event]; + + [super touchesEnded:touches withEvent:event]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [self.delayTimer fire]; - [self.view touchesCancelled:touches withEvent:event]; -}; + [self.godotView godotTouchesCancelled:touches withEvent:event]; + + [super touchesCancelled:touches withEvent:event]; +} - (NSSet *)copyClearedTouches:(NSSet *)touches phase:(UITouchPhase)phaseToSave { NSMutableSet *cleared = [touches mutableCopy]; for (UITouch *touch in touches) { - if (touch.phase != phaseToSave) { + if (touch.view != self.view || touch.phase != phaseToSave) { [cleared removeObject:touch]; } } diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp index c68ac655a8..bea54ae1cb 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.cpp +++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp @@ -46,14 +46,14 @@ extern void godot_js_os_download_buffer(const uint8_t *p_buf, int p_buf_size, co } static void _javascript_editor_init_callback() { - EditorNode::get_singleton()->add_editor_plugin(memnew(JavaScriptToolsEditorPlugin(EditorNode::get_singleton()))); + EditorNode::get_singleton()->add_editor_plugin(memnew(JavaScriptToolsEditorPlugin)); } void JavaScriptToolsEditorPlugin::initialize() { EditorNode::add_init_callback(_javascript_editor_init_callback); } -JavaScriptToolsEditorPlugin::JavaScriptToolsEditorPlugin(EditorNode *p_editor) { +JavaScriptToolsEditorPlugin::JavaScriptToolsEditorPlugin() { add_tool_menu_item("Download Project Source", callable_mp(this, &JavaScriptToolsEditorPlugin::_download_zip)); } diff --git a/platform/javascript/api/javascript_tools_editor_plugin.h b/platform/javascript/api/javascript_tools_editor_plugin.h index 08f10b01dc..cbf5f49497 100644 --- a/platform/javascript/api/javascript_tools_editor_plugin.h +++ b/platform/javascript/api/javascript_tools_editor_plugin.h @@ -46,7 +46,7 @@ private: public: static void initialize(); - JavaScriptToolsEditorPlugin(EditorNode *p_editor); + JavaScriptToolsEditorPlugin(); }; #else class JavaScriptToolsEditorPlugin { diff --git a/platform/javascript/export/export_plugin.cpp b/platform/javascript/export/export_plugin.cpp index d4c198d631..8a1360e421 100644 --- a/platform/javascript/export/export_plugin.cpp +++ b/platform/javascript/export/export_plugin.cpp @@ -30,6 +30,9 @@ #include "export_plugin.h" +#include "core/config/project_settings.h" +#include "editor/editor_node.h" + Error EditorExportPlatformJavaScript::_extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa) { FileAccess *src_f = nullptr; zlib_filefunc_def io = zipio_create_io_from_file(&src_f); diff --git a/platform/javascript/export/export_plugin.h b/platform/javascript/export/export_plugin.h index 278e317430..8d4307548c 100644 --- a/platform/javascript/export/export_plugin.h +++ b/platform/javascript/export/export_plugin.h @@ -31,18 +31,20 @@ #ifndef JAVASCRIPT_EXPORT_PLUGIN_H #define JAVASCRIPT_EXPORT_PLUGIN_H +#include "core/config/project_settings.h" #include "core/io/image_loader.h" #include "core/io/stream_peer_ssl.h" #include "core/io/tcp_server.h" #include "core/io/zip_io.h" #include "editor/editor_export.h" -#include "editor/editor_node.h" #include "main/splash.gen.h" #include "platform/javascript/logo.gen.h" #include "platform/javascript/run_icon.gen.h" #include "export_server.h" +class EditorNode; + class EditorExportPlatformJavaScript : public EditorExportPlatform { GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform); diff --git a/platform/javascript/js/libs/library_godot_fetch.js b/platform/javascript/js/libs/library_godot_fetch.js index 285e50a035..007e7b70f5 100644 --- a/platform/javascript/js/libs/library_godot_fetch.js +++ b/platform/javascript/js/libs/library_godot_fetch.js @@ -89,6 +89,7 @@ const GodotFetch = { method: method, headers: headers, body: body, + credentials: 'include', }; obj.request = fetch(url, init); obj.request.then(GodotFetch.onresponse.bind(null, id)).catch(GodotFetch.onerror.bind(null, id)); diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index bf9c9b1766..86c3534fc9 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -1077,7 +1077,7 @@ float DisplayServerX11::screen_get_refresh_rate(int p_screen) const { monitors = xrr_get_monitors(x11_display, windows[MAIN_WINDOW_ID].x11_window, true, &count); ERR_FAIL_INDEX_V(p_screen, count, SCREEN_REFRESH_RATE_FALLBACK); } else { - ERR_PRINT("An error occured while trying to get the screen refresh rate."); + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); return SCREEN_REFRESH_RATE_FALLBACK; } @@ -1105,14 +1105,14 @@ float DisplayServerX11::screen_get_refresh_rate(int p_screen) const { } } - ERR_PRINT("An error occured while trying to get the screen refresh rate."); // We should have returned the refresh rate by now. An error must have occured. + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); // We should have returned the refresh rate by now. An error must have occurred. return SCREEN_REFRESH_RATE_FALLBACK; } else { - ERR_PRINT("An error occured while trying to get the screen refresh rate."); + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); return SCREEN_REFRESH_RATE_FALLBACK; } } - ERR_PRINT("An error occured while trying to get the screen refresh rate."); + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); return SCREEN_REFRESH_RATE_FALLBACK; } diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index ad6e4cd168..d97a528ece 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -39,8 +39,6 @@ #include "drivers/unix/os_unix.h" #include "joypad_linux.h" #include "servers/audio_server.h" -#include "servers/rendering/renderer_compositor.h" -#include "servers/rendering_server.h" class OS_LinuxBSD : public OS_Unix { virtual void delete_main_loop() override; diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h index eaf03d298e..2b57983ca7 100644 --- a/platform/osx/display_server_osx.h +++ b/platform/osx/display_server_osx.h @@ -95,6 +95,7 @@ public: ObjectID instance_id; WindowID transient_parent = INVALID_WINDOW_ID; + bool exclusive = false; Set<WindowID> transient_children; bool layered_window = false; @@ -274,6 +275,7 @@ public: virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override; virtual void window_set_transient(WindowID p_window, WindowID p_parent) override; + virtual void window_set_exclusive(WindowID p_window, bool p_exclusive) override; virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override; virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const override; diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 2691664b96..b7258e6cf4 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -1335,7 +1335,7 @@ float DisplayServerOSX::screen_get_refresh_rate(int p_screen) const { const double displayRefreshRate = CGDisplayModeGetRefreshRate(displayMode); return (float)displayRefreshRate; } - ERR_PRINT("An error occured while trying to get the screen refresh rate."); + ERR_PRINT("An error occurred while trying to get the screen refresh rate."); return SCREEN_REFRESH_RATE_FALLBACK; } @@ -1471,6 +1471,24 @@ void DisplayServerOSX::window_set_current_screen(int p_screen, WindowID p_window } } +void DisplayServerOSX::window_set_exclusive(WindowID p_window, bool p_exclusive) { + _THREAD_SAFE_METHOD_ + ERR_FAIL_COND(!windows.has(p_window)); + WindowData &wd = windows[p_window]; + if (wd.exclusive != p_exclusive) { + wd.exclusive = p_exclusive; + if (wd.transient_parent != INVALID_WINDOW_ID) { + WindowData &wd_parent = windows[wd.transient_parent]; + if (wd.exclusive) { + ERR_FAIL_COND_MSG([[wd_parent.window_object childWindows] count] > 0, "Transient parent has another exclusive child."); + [wd_parent.window_object addChildWindow:wd.window_object ordered:NSWindowAbove]; + } else { + [wd_parent.window_object removeChildWindow:wd.window_object]; + } + } + } +} + Point2i DisplayServerOSX::window_get_position(WindowID p_window) const { _THREAD_SAFE_METHOD_ @@ -1541,8 +1559,11 @@ void DisplayServerOSX::window_set_transient(WindowID p_window, WindowID p_parent wd_window.transient_parent = INVALID_WINDOW_ID; wd_parent.transient_children.erase(p_window); - [wd_window.window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + + if (wd_window.exclusive) { + [wd_parent.window_object removeChildWindow:wd_window.window_object]; + } } else { ERR_FAIL_COND(!windows.has(p_parent)); ERR_FAIL_COND_MSG(wd_window.transient_parent != INVALID_WINDOW_ID, "Window already has a transient parent"); @@ -1550,8 +1571,11 @@ void DisplayServerOSX::window_set_transient(WindowID p_window, WindowID p_parent wd_window.transient_parent = p_parent; wd_parent.transient_children.insert(p_window); - [wd_window.window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; + + if (wd_window.exclusive) { + [wd_parent.window_object addChildWindow:wd_window.window_object ordered:NSWindowAbove]; + } } } diff --git a/platform/osx/export/codesign.cpp b/platform/osx/export/codesign.cpp index 8ea6ff519d..8d1d147196 100644 --- a/platform/osx/export/codesign.cpp +++ b/platform/osx/export/codesign.cpp @@ -1359,9 +1359,12 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const // Generate common signature structures. if (id.is_empty()) { - Ref<Crypto> crypto = Ref<Crypto>(Crypto::create()); - PackedByteArray uuid = crypto->generate_random_bytes(16); - id = (String("a-55554944") /*a-UUID*/ + String::hex_encode_buffer(uuid.ptr(), 16)); + CryptoCore::RandomGenerator rng; + ERR_FAIL_COND_V_MSG(rng.init(), FAILED, "Failed to initialize random number generator."); + uint8_t uuid[16]; + Error err = rng.get_random_bytes(uuid, 16); + ERR_FAIL_COND_V_MSG(err, err, "Failed to generate UUID."); + id = (String("a-55554944") /*a-UUID*/ + String::hex_encode_buffer(uuid, 16)); } CharString uuid_str = id.utf8(); print_verbose(vformat("CodeSign: Used bundle ID: %s", id)); diff --git a/platform/osx/export/codesign.h b/platform/osx/export/codesign.h index 927df79281..e5e9be5c28 100644 --- a/platform/osx/export/codesign.h +++ b/platform/osx/export/codesign.h @@ -41,7 +41,6 @@ #ifndef CODESIGN_H #define CODESIGN_H -#include "core/crypto/crypto.h" #include "core/crypto/crypto_core.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" diff --git a/platform/osx/export/export_plugin.cpp b/platform/osx/export/export_plugin.cpp index f0b58efb63..4d5c0a827a 100644 --- a/platform/osx/export/export_plugin.cpp +++ b/platform/osx/export/export_plugin.cpp @@ -31,6 +31,7 @@ #include "modules/modules_enabled.gen.h" // For regex. #include "codesign.h" +#include "editor/editor_node.h" #include "export_plugin.h" void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { diff --git a/platform/osx/export/export_plugin.h b/platform/osx/export/export_plugin.h index 931ce7e41a..b85e9d662c 100644 --- a/platform/osx/export/export_plugin.h +++ b/platform/osx/export/export_plugin.h @@ -40,7 +40,6 @@ #include "core/os/os.h" #include "core/version.h" #include "editor/editor_export.h" -#include "editor/editor_node.h" #include "editor/editor_settings.h" #include "platform/osx/logo.gen.h" diff --git a/platform/osx/godot_content_view.mm b/platform/osx/godot_content_view.mm index 4e831e1ccc..76d9cfb081 100644 --- a/platform/osx/godot_content_view.mm +++ b/platform/osx/godot_content_view.mm @@ -117,6 +117,10 @@ } } +- (void)doCommandBySelector:(SEL)aSelector { + [self tryToPerform:aSelector with:self]; +} + - (void)unmarkText { ime_input_event_in_progress = false; [[marked_text mutableString] setString:@""]; diff --git a/platform/uwp/export/app_packager.cpp b/platform/uwp/export/app_packager.cpp index 9b586a640e..c7b3bc9854 100644 --- a/platform/uwp/export/app_packager.cpp +++ b/platform/uwp/export/app_packager.cpp @@ -30,6 +30,8 @@ #include "app_packager.h" +#include "editor/editor_node.h" + String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len) { unsigned char hash[32]; char base64[45]; diff --git a/platform/uwp/export/app_packager.h b/platform/uwp/export/app_packager.h index a5f5896592..da118449c7 100644 --- a/platform/uwp/export/app_packager.h +++ b/platform/uwp/export/app_packager.h @@ -41,7 +41,6 @@ #include "core/object/class_db.h" #include "core/version.h" #include "editor/editor_export.h" -#include "editor/editor_node.h" #include "thirdparty/minizip/unzip.h" #include "thirdparty/minizip/zip.h" diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 20268b3f6a..c7955ebf31 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -830,6 +830,23 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window _update_real_mouse_position(p_window); } +void DisplayServerWindows::window_set_exclusive(WindowID p_window, bool p_exclusive) { + _THREAD_SAFE_METHOD_ + ERR_FAIL_COND(!windows.has(p_window)); + WindowData &wd = windows[p_window]; + if (wd.exclusive != p_exclusive) { + wd.exclusive = p_exclusive; + if (wd.transient_parent != INVALID_WINDOW_ID) { + WindowData &wd_parent = windows[wd.transient_parent]; + if (wd.exclusive) { + SetWindowLongPtr(wd.hWnd, GWLP_HWNDPARENT, (LONG_PTR)wd_parent.hWnd); + } else { + SetWindowLongPtr(wd.hWnd, GWLP_HWNDPARENT, (LONG_PTR) nullptr); + } + } + } +} + void DisplayServerWindows::window_set_transient(WindowID p_window, WindowID p_parent) { _THREAD_SAFE_METHOD_ @@ -852,7 +869,9 @@ void DisplayServerWindows::window_set_transient(WindowID p_window, WindowID p_pa wd_window.transient_parent = INVALID_WINDOW_ID; wd_parent.transient_children.erase(p_window); - SetWindowLongPtr(wd_window.hWnd, GWLP_HWNDPARENT, (LONG_PTR) nullptr); + if (wd_window.exclusive) { + SetWindowLongPtr(wd_window.hWnd, GWLP_HWNDPARENT, (LONG_PTR) nullptr); + } } else { ERR_FAIL_COND(!windows.has(p_parent)); ERR_FAIL_COND_MSG(wd_window.transient_parent != INVALID_WINDOW_ID, "Window already has a transient parent"); @@ -861,7 +880,9 @@ void DisplayServerWindows::window_set_transient(WindowID p_window, WindowID p_pa wd_window.transient_parent = p_parent; wd_parent.transient_children.insert(p_window); - SetWindowLongPtr(wd_window.hWnd, GWLP_HWNDPARENT, (LONG_PTR)wd_parent.hWnd); + if (wd_window.exclusive) { + SetWindowLongPtr(wd_window.hWnd, GWLP_HWNDPARENT, (LONG_PTR)wd_parent.hWnd); + } } } @@ -1023,6 +1044,7 @@ void DisplayServerWindows::_get_window_style(bool p_main_window, bool p_fullscre r_style_ex |= WS_EX_TOPMOST | WS_EX_NOACTIVATE; } r_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + r_style_ex |= WS_EX_ACCEPTFILES; } void DisplayServerWindows::_update_window_style(WindowID p_window, bool p_repaint) { @@ -1099,10 +1121,10 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) if (p_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN) { wd.multiwindow_fs = false; - _update_window_style(false); + _update_window_style(p_window, false); } else { wd.multiwindow_fs = true; - _update_window_style(false); + _update_window_style(p_window, false); } if ((p_mode == WINDOW_MODE_FULLSCREEN || p_mode == WINDOW_MODE_EXCLUSIVE_FULLSCREEN) && !wd.fullscreen) { @@ -1123,7 +1145,7 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window) wd.maximized = false; wd.minimized = false; - _update_window_style(false); + _update_window_style(p_window, false); MoveWindow(wd.hWnd, pos.x, pos.y, size.width, size.height, TRUE); diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index d36ca97ebe..7561f9bb77 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -339,6 +339,7 @@ class DisplayServerWindows : public DisplayServer { bool always_on_top = false; bool no_focus = false; bool window_has_focus = false; + bool exclusive = false; // Used to transfer data between events using timer. WPARAM saved_wparam; @@ -499,6 +500,7 @@ public: virtual void window_set_position(const Point2i &p_position, WindowID p_window = MAIN_WINDOW_ID) override; virtual void window_set_transient(WindowID p_window, WindowID p_parent) override; + virtual void window_set_exclusive(WindowID p_window, bool p_exclusive) override; virtual void window_set_max_size(const Size2i p_size, WindowID p_window = MAIN_WINDOW_ID) override; virtual Size2i window_get_max_size(WindowID p_window = MAIN_WINDOW_ID) const override; diff --git a/platform/windows/export/export_plugin.cpp b/platform/windows/export/export_plugin.cpp index d30d0afc5c..5ebc930735 100644 --- a/platform/windows/export/export_plugin.cpp +++ b/platform/windows/export/export_plugin.cpp @@ -30,6 +30,9 @@ #include "export_plugin.h" +#include "core/config/project_settings.h" +#include "editor/editor_node.h" + Error EditorExportPlatformWindows::sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path) { if (p_preset->get("codesign/enable")) { return _code_sign(p_preset, p_path); diff --git a/platform/windows/export/export_plugin.h b/platform/windows/export/export_plugin.h index 89e5b1b635..86e9d49b05 100644 --- a/platform/windows/export/export_plugin.h +++ b/platform/windows/export/export_plugin.h @@ -34,7 +34,6 @@ #include "core/io/file_access.h" #include "core/os/os.h" #include "editor/editor_export.h" -#include "editor/editor_node.h" #include "editor/editor_settings.h" #include "platform/windows/logo.gen.h" diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index d844531071..59f55b5dd2 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -46,6 +46,7 @@ #include "windows_terminal_logger.h" #include <avrt.h> +#include <bcrypt.h> #include <direct.h> #include <knownfolders.h> #include <process.h> @@ -192,6 +193,12 @@ void OS_Windows::finalize_core() { NetSocketPosix::cleanup(); } +Error OS_Windows::get_entropy(uint8_t *r_buffer, int p_bytes) { + NTSTATUS status = BCryptGenRandom(nullptr, r_buffer, p_bytes, BCRYPT_USE_SYSTEM_PREFERRED_RNG); + ERR_FAIL_COND_V(status, FAILED); + return OK; +} + Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { String path = p_path.replace("/", "\\"); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 28baa855b4..bde663a27b 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -40,8 +40,6 @@ #include "drivers/winmidi/midi_driver_winmidi.h" #include "key_mapping_windows.h" #include "servers/audio_server.h" -#include "servers/rendering/renderer_compositor.h" -#include "servers/rendering_server.h" #ifdef XAUDIO2_ENABLED #include "drivers/xaudio2/audio_driver_xaudio2.h" #endif @@ -108,6 +106,8 @@ protected: public: virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override; + virtual Error get_entropy(uint8_t *r_buffer, int p_bytes) override; + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override; virtual Error close_dynamic_library(void *p_library_handle) override; virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override; |