From f02a040d48bc53ce8d90085b809db9a66c6ff2de Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 23 Mar 2020 22:09:22 +0100 Subject: [PATCH] Define a default minimum window size to workaround rendering issues The minimum window size can still be set to `Vector2(0, 0)` in a script if needed. This closes #37242. --- doc/classes/DisplayServer.xml | 2 ++ main/main.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index abb715b34e..4f495eaec9 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -649,6 +649,8 @@ + Sets the minimum size for the given window to [code]min_size[/code] (in pixels). + [b]Note:[/b] By default, the main window has a minimum size of [code]Vector2i(64, 64)[/code]. This prevents issues that can arise when the window is resized to a near-zero size. diff --git a/main/main.cpp b/main/main.cpp index 6764332f16..1ab0f7e0d7 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2242,6 +2242,10 @@ bool Main::start() { DisplayServer::get_singleton()->window_set_title(appname); #endif + // Define a very small minimum window size to prevent bugs such as GH-37242. + // It can still be overridden by the user in a script. + DisplayServer::get_singleton()->window_set_min_size(Size2i(64, 64)); + bool snap_controls = GLOBAL_DEF("gui/common/snap_controls_to_pixels", true); sml->get_root()->set_snap_controls_to_pixels(snap_controls);