diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-08 11:21:46 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-08 11:21:46 +0200 |
commit | bca2c30b7d38f3cad2b06ae30ee7d73e15677373 (patch) | |
tree | f4e7c00f362877f746623985219eb5e31b3f5c8f /scene/gui/file_dialog.cpp | |
parent | d56fb753a4b637b4bc7b02d23e5bb39e7d46a421 (diff) | |
parent | 44e2c56daac7f326c52317ebe9fef52b411fdec3 (diff) | |
download | redot-engine-bca2c30b7d38f3cad2b06ae30ee7d73e15677373.tar.gz |
Merge pull request #90318 from YeldhamDev/not_native_enough
Fix built-in `FileDialog` appearing instead of the native one on some cases
Diffstat (limited to 'scene/gui/file_dialog.cpp')
-rw-r--r-- | scene/gui/file_dialog.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 3816b337b8..12b2364ddf 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -170,6 +170,20 @@ void FileDialog::_validate_property(PropertyInfo &p_property) const { void FileDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_READY: { +#ifdef TOOLS_ENABLED + if (is_part_of_edited_scene()) { + return; + } +#endif + + // Replace the built-in dialog with the native one if it started visible. + if (is_visible() && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE) && (use_native_dialog || OS::get_singleton()->is_sandboxed())) { + ConfirmationDialog::set_visible(false); + _native_popup(); + } + } break; + case NOTIFICATION_VISIBILITY_CHANGED: { if (!is_visible()) { set_process_shortcut_input(false); @@ -1392,6 +1406,18 @@ void FileDialog::set_default_show_hidden_files(bool p_show) { void FileDialog::set_use_native_dialog(bool p_native) { use_native_dialog = p_native; + +#ifdef TOOLS_ENABLED + if (is_part_of_edited_scene()) { + return; + } +#endif + + // Replace the built-in dialog with the native one if it's currently visible. + if (is_visible() && DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE) && (use_native_dialog || OS::get_singleton()->is_sandboxed())) { + ConfirmationDialog::set_visible(false); + _native_popup(); + } } bool FileDialog::get_use_native_dialog() const { |