Skip to content
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

fix: max window size defaults to 0 #33025

Merged
merged 2 commits into from Mar 1, 2022

Conversation

codebytere
Copy link
Member

Description of Change

Closes #32995.

Fixes an issue where setting window maxHeight or maxWidth made it so the width and height could no longer be resized.

#32628 fixed an issue with maxWidth not being respected at all, but also changed defaults such that max_width and max_height conformed to size_constraints.GetMaximumSize(). By default, size_constraints.GetMaximumSize() returns (0, 0) unless it's been previously set, so this accidentally made it such that the maxHeight couldn't be changed if the maxWidth was set, and vice versa. This fixes that issue.

Checklist

Release Notes

Notes: Fixed an issue where setting window maxHeight or maxWidth made it so the width and height could no longer be resized.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/17-x-y labels Feb 21, 2022
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Feb 21, 2022
@codebytere codebytere requested review from a team as code owners February 21, 2022 11:06
@codebytere codebytere force-pushed the fix-independent-maxwidth-max-height branch from e67200b to b38d835 Compare February 21, 2022 18:38
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Feb 22, 2022
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting maximum size to (INT_MAX, INT_MAX), the code should only call size_constraints.set_maximum_size when there is a maximum size set.

By default the window has a default maximum size that prevents it from being resized larger than screen, assigning a maximum size would override this behavior, see also:

if (enable_larger_than_screen())
// We need to set a default maximum window size here otherwise Windows
// will not allow us to resize the window larger than scree.
// Setting directly to INT_MAX somehow doesn't work, so we just divide
// by 10, which should still be large enough.
SetContentSizeConstraints(extensions::SizeConstraints(
gfx::Size(), gfx::Size(INT_MAX / 10, INT_MAX / 10)));

@codebytere codebytere force-pushed the fix-independent-maxwidth-max-height branch 2 times, most recently from a0dd22e to 30d5e96 Compare February 23, 2022 09:52
@codebytere codebytere force-pushed the fix-independent-maxwidth-max-height branch from 94de305 to 99bc58b Compare February 28, 2022 19:44
@codebytere
Copy link
Member Author

Failure not relevant - merging.

@codebytere codebytere merged commit ebd80a0 into main Mar 1, 2022
@codebytere codebytere deleted the fix-independent-maxwidth-max-height branch March 1, 2022 22:20
@release-clerk
Copy link

release-clerk bot commented Mar 1, 2022

Release Notes Persisted

Fixed an issue where setting window maxHeight or maxWidth made it so the width and height could no longer be resized.

@trop
Copy link
Contributor

trop bot commented Mar 1, 2022

I have automatically backported this PR to "17-x-y", please check out #33118

@trop
Copy link
Contributor

trop bot commented Mar 1, 2022

I have automatically backported this PR to "18-x-y", please check out #33119

bavulapati pushed a commit to bavulapati/electron that referenced this pull request Apr 29, 2022
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: unable to resize height when maxWidth set
3 participants