From 2d7bd62a5614c0664c9a2af3277489daa035a27f Mon Sep 17 00:00:00 2001 From: Martin Sandin Date: Thu, 10 Jul 2025 23:27:49 +0200 Subject: [PATCH] Make sure the max window size resize constraint is unset if set to infinity The problem here is that if one tries to set the window resize constraint back to e.g. Default::default() where the max window size happens to be infinity then the max window resize constraint won't actually be changed at all, thus making it impossible to actually do this change. I believe this logic might be copied from the window creation logic over here: https://github.com/bevyengine/bevy/blob/6792cebfd0d49a167aeb70fa03a136a512707e53/crates/bevy_winit/src/winit_windows.rs#L262 but in that instance the logic makes sense because it is known that the max size constraint will be None, since it's initialized to default at the top of that function. --- crates/bevy_winit/src/system.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/bevy_winit/src/system.rs b/crates/bevy_winit/src/system.rs index 6d3a76c9b3728..591a54340201a 100644 --- a/crates/bevy_winit/src/system.rs +++ b/crates/bevy_winit/src/system.rs @@ -439,9 +439,13 @@ pub(crate) fn changed_windows( }; winit_window.set_min_inner_size(Some(min_inner_size)); - if constraints.max_width.is_finite() && constraints.max_height.is_finite() { - winit_window.set_max_inner_size(Some(max_inner_size)); - } + winit_window.set_max_inner_size( + if constraints.max_width.is_finite() && constraints.max_height.is_finite() { + Some(max_inner_size) + } else { + None + }, + ); } if window.position != cache.position {