diff options
author | Yuri Sizov <yuris@humnom.net> | 2022-09-02 17:45:09 +0300 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2022-09-02 23:44:23 +0300 |
commit | 8b128081e82b41f1ea5d7799236f17e6f2c1d087 (patch) | |
tree | 6f232a809d623c0cf89cd0940a29e5758cc90837 /scene/main | |
parent | ddc55ef746e6778b902aa2ebeaf09d9b8d9943b5 (diff) |
Un-defer the initial theme changed notification
Co-authored-by: Rindbee <idleman@yeah.net>
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/window.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 8be6fe3e1c..84e4162c00 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -805,6 +805,14 @@ void Window::_notification(int p_what) { _update_theme_item_cache(); } break; + case NOTIFICATION_PARENTED: { + theme_owner->assign_theme_on_parented(this); + } break; + + case NOTIFICATION_UNPARENTED: { + theme_owner->clear_theme_on_unparented(this); + } break; + case NOTIFICATION_ENTER_TREE: { bool embedded = false; { @@ -1290,23 +1298,12 @@ Rect2i Window::get_usable_parent_rect() const { } void Window::add_child_notify(Node *p_child) { - // We propagate when this node uses a custom theme, so it can pass it on to its children. - if (has_theme_owner_node()) { - // `p_notify` is false here as `NOTIFICATION_THEME_CHANGED` will be handled by `NOTIFICATION_ENTER_TREE`. - theme_owner->propagate_theme_changed(p_child, get_theme_owner_node(), false, true); - } - if (is_inside_tree() && wrap_controls) { child_controls_changed(); } } void Window::remove_child_notify(Node *p_child) { - // If the removed child isn't inheriting any theme items through this node, then there's no need to propagate. - if (has_theme_owner_node()) { - theme_owner->propagate_theme_changed(p_child, nullptr, false, true); - } - if (is_inside_tree() && wrap_controls) { child_controls_changed(); } |