Skip to content

The max window size resize constraint should be unset if set to infinity #20079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

msandin
Copy link

@msandin msandin commented Jul 10, 2025

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:

let winit_window_attributes =

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.

…finity

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.
Copy link
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@tychedelia tychedelia added this to the 0.17 milestone Jul 10, 2025
@tychedelia tychedelia added C-Bug An unexpected or incorrect behavior A-Windowing Platform-agnostic interface layer to run your app in S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 10, 2025
@alice-i-cecile alice-i-cecile added the D-Straightforward Simple bug fixes and API improvements, docs, test and examples label Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants