The max window size resize constraint should be unset if set to infinity #20079
+7
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
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:
bevy/crates/bevy_winit/src/winit_windows.rs
Line 262 in 6792ceb
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.
Solution
Unconditionally set the max size constraint, just to None if either dimension is Infinity, which should produce the same outcome as the window creation logic
Testing
Did you test these changes? If so, how?
Only in so far that I confirmed the problem: if you try to change resize constraints back to Default::default() then no change will be made to the max resize constraint. This was confirmed after spotting the issue, so spotting it clearly had some predictive power.
Are there any parts that need more testing?
How can other people (reviewers) test your changes? Is there anything specific they need to know?
If relevant, what platforms did you test these changes on, and are there any important ones you can't test?
I found this problem when researching a different problem that only shows up on X11, where the resize constraint prevents full screen from working correctly. Unfortunately we've confirmed that fixing this problem, while helpful on Windows, isn't enough to fix the full issue on X11. But that problem is unrelated to this and needs to be done in addition to this one, which is clearly a bug on every platform.