1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Use switch consistently in _notification (scene folder)

This commit is contained in:
Rémi Verschelde
2022-02-15 18:06:48 +01:00
parent 171021145d
commit 0f5455230c
127 changed files with 2853 additions and 2601 deletions

View File

@@ -738,18 +738,16 @@ void Window::_notification(int p_what) {
bool embedded = false;
{
embedder = _get_embedder();
if (embedder) {
embedded = true;
if (!visible) {
embedder = nullptr; //not yet since not visible
embedder = nullptr; // Not yet since not visible.
}
}
}
if (embedded) {
//create as embedded
// Create as embedded.
if (embedder) {
embedder->_sub_window_register(this);
RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE);
@@ -757,22 +755,22 @@ void Window::_notification(int p_what) {
}
} else {
if (get_parent() == nullptr) {
//it's the root window!
visible = true; //always visible
if (!get_parent()) {
// It's the root window!
visible = true; // Always visible.
window_id = DisplayServer::MAIN_WINDOW_ID;
DisplayServer::get_singleton()->window_attach_instance_id(get_instance_id(), window_id);
_update_from_window();
//since this window already exists (created on start), we must update pos and size from it
// Since this window already exists (created on start), we must update pos and size from it.
{
position = DisplayServer::get_singleton()->window_get_position(window_id);
size = DisplayServer::get_singleton()->window_get_size(window_id);
}
_update_viewport_size(); //then feed back to the viewport
_update_viewport_size(); // Then feed back to the viewport.
_update_window_callbacks();
RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE);
} else {
//create
// Create.
if (visible) {
_make_window();
}
@@ -788,11 +786,13 @@ void Window::_notification(int p_what) {
RS::get_singleton()->viewport_set_active(get_viewport_rid(), true);
}
} break;
case NOTIFICATION_READY: {
if (wrap_controls) {
_update_child_controls();
}
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
if (embedder) {
embedder->_sub_window_update(this);
@@ -811,6 +811,7 @@ void Window::_notification(int p_what) {
child_controls_changed();
} break;
case NOTIFICATION_EXIT_TREE: {
if (transient) {
_clear_transient();