Browse Source

Limit window size updates on title change.

(cherry picked from commit 5dd11e8eee739f2ac3bbecd93cd4862c151aebc8)
bruvzg 1 year ago
parent
commit
1fcf635383
1 changed files with 7 additions and 1 deletions
  1. 7 1
      scene/main/window.cpp

+ 7 - 1
scene/main/window.cpp

@@ -284,7 +284,13 @@ void Window::set_title(const String &p_title) {
 		embedder->_sub_window_update(this);
 	} else if (window_id != DisplayServer::INVALID_WINDOW_ID) {
 		DisplayServer::get_singleton()->window_set_title(tr_title, window_id);
-		_update_window_size();
+		if (keep_title_visible) {
+			Size2i title_size = DisplayServer::get_singleton()->window_get_title_size(tr_title, window_id);
+			Size2i size_limit = get_clamped_minimum_size();
+			if (title_size.x > size_limit.x || title_size.y > size_limit.y) {
+				_update_window_size();
+			}
+		}
 	}
 }