diff options
author | Rindbee <idleman@yeah.net> | 2022-06-20 21:32:06 +0800 |
---|---|---|
committer | Rindbee <idleman@yeah.net> | 2022-06-20 21:45:08 +0800 |
commit | 5ac259fad84c2028b3cdec90cf7930ad377d9d03 (patch) | |
tree | de388b8c02dc60ea1eacb1dc19febf74783bfd5d | |
parent | 460a083e2b5f75fd3e5d3d3d3d393cbb0c4f2a2a (diff) |
Quickfix editor hangs when rooting a window with exclusive and transient flags enabled
-rw-r--r-- | scene/main/window.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp index d650dffdbd..69fb5fdf07 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -154,7 +154,7 @@ void Window::set_flag(Flags p_flag, bool p_enabled) { } else if (window_id != DisplayServer::INVALID_WINDOW_ID) { #ifdef TOOLS_ENABLED - if ((p_flag != FLAG_POPUP) || !(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if ((p_flag != FLAG_POPUP) || !(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { DisplayServer::get_singleton()->window_set_flag(DisplayServer::WindowFlags(p_flag), p_enabled, window_id); } #else @@ -167,7 +167,7 @@ bool Window::get_flag(Flags p_flag) const { ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false); if (window_id != DisplayServer::INVALID_WINDOW_ID) { #ifdef TOOLS_ENABLED - if ((p_flag != FLAG_POPUP) || !(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if ((p_flag != FLAG_POPUP) || !(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { flags[p_flag] = DisplayServer::get_singleton()->window_get_flag(DisplayServer::WindowFlags(p_flag), window_id); } #else @@ -256,7 +256,7 @@ void Window::_make_window() { DisplayServer::get_singleton()->window_set_title(tr_title, window_id); DisplayServer::get_singleton()->window_attach_instance_id(get_instance_id(), window_id); #ifdef TOOLS_ENABLED - if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { DisplayServer::get_singleton()->window_set_exclusive(window_id, exclusive); } else { DisplayServer::get_singleton()->window_set_exclusive(window_id, false); @@ -445,7 +445,7 @@ void Window::set_visible(bool p_visible) { if (transient_parent) { if (exclusive && visible) { #ifdef TOOLS_ENABLED - if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { ERR_FAIL_COND_MSG(transient_parent->exclusive_child && transient_parent->exclusive_child != this, "Transient parent has another exclusive child."); transient_parent->exclusive_child = this; } @@ -499,7 +499,7 @@ void Window::_make_transient() { if (is_inside_tree() && is_visible() && exclusive) { if (transient_parent->exclusive_child == nullptr) { #ifdef TOOLS_ENABLED - if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { transient_parent->exclusive_child = this; } #else @@ -548,7 +548,7 @@ void Window::set_exclusive(bool p_exclusive) { if (!embedder && window_id != DisplayServer::INVALID_WINDOW_ID) { #ifdef TOOLS_ENABLED - if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { DisplayServer::get_singleton()->window_set_exclusive(window_id, exclusive); } else { DisplayServer::get_singleton()->window_set_exclusive(window_id, false); @@ -562,7 +562,7 @@ void Window::set_exclusive(bool p_exclusive) { if (p_exclusive && is_inside_tree() && is_visible()) { ERR_FAIL_COND_MSG(transient_parent->exclusive_child && transient_parent->exclusive_child != this, "Transient parent has another exclusive child."); #ifdef TOOLS_ENABLED - if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { + if (!(Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root()->is_ancestor_of(this) || get_tree()->get_edited_scene_root() == this))) { transient_parent->exclusive_child = this; } #else |