Skip to content

Commit

Permalink
Merge pull request #37260 from Calinou/define-minimum-window-size
Browse files Browse the repository at this point in the history
Define a default minimum window size to workaround rendering issues
  • Loading branch information
Calinou authored Aug 22, 2021
2 parents 57e3a1a + f02a040 commit 337574d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/classes/DisplayServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@
<argument index="0" name="min_size" type="Vector2i" />
<argument index="1" name="window_id" type="int" default="0" />
<description>
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.
</description>
</method>
<method name="window_set_mode">
Expand Down
4 changes: 4 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 337574d

Please sign in to comment.