From f6ee1e15fc2016f65422fc13563395a26c9b8ad0 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Thu, 17 Jul 2025 11:11:01 +0100 Subject: [PATCH] Do not poll for system theme changes The DisplayServer interface has change notification for theme changes. As far as I can tell, all display servers with a concept of system theme also implement the DisplayServer::set_system_theme_change_callback(const Callable &p_callable) method. So there should be no need to poll every second for the system theme. --- editor/editor_node.cpp | 6 ------ editor/editor_node.h | 1 - 2 files changed, 7 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 06d598f97dc..8f47a4173ca 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -8861,12 +8861,6 @@ EditorNode::EditorNode() { follow_system_theme = EDITOR_GET("interface/theme/follow_system_theme"); use_system_accent_color = EDITOR_GET("interface/theme/use_system_accent_color"); - system_theme_timer = memnew(Timer); - system_theme_timer->set_wait_time(1.0); - system_theme_timer->connect("timeout", callable_mp(this, &EditorNode::_check_system_theme_changed)); - add_child(system_theme_timer); - system_theme_timer->set_owner(get_owner()); - system_theme_timer->set_autostart(true); } EditorNode::~EditorNode() { diff --git a/editor/editor_node.h b/editor/editor_node.h index b893f45faa2..3f65f1c7fec 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -362,7 +362,6 @@ private: Ref theme; - Timer *system_theme_timer = nullptr; bool follow_system_theme = false; bool use_system_accent_color = false; bool last_dark_mode_state = false;