From 59f24d8867c3f95eaa3020afb25f979bacd56bc1 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 22 Aug 2021 09:11:21 +0200 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. --- doc/classes/OS.xml | 3 ++- main/main.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 9c11a7b3aa0..86d63cefd48 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -939,7 +939,8 @@ The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. - The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value. + The minimum size of the window in pixels (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system's default value. + [b]Note:[/b] By default, the project window has a minimum size of [code]Vector2(64, 64)[/code]. This prevents issues that can arise when the window is resized to a near-zero size. The current screen orientation. diff --git a/main/main.cpp b/main/main.cpp index 0be70e53af4..33878ab1163 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1878,6 +1878,10 @@ bool Main::start() { OS::get_singleton()->set_window_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. + OS::get_singleton()->set_min_window_size(Size2(64, 64)); + int shadow_atlas_size = GLOBAL_GET("rendering/quality/shadow_atlas/size"); int shadow_atlas_q0_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_0_subdiv"); int shadow_atlas_q1_subdiv = GLOBAL_GET("rendering/quality/shadow_atlas/quadrant_1_subdiv");