fix: maximized state calculation for non-resizable windows (#30989)

This commit is contained in:
Shelley Vohr 2021-09-21 12:04:32 +02:00 committed by GitHub
parent 92bff00d43
commit 629d8913f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 11 deletions

View file

@ -63,8 +63,11 @@ using FullScreenTransitionState =
// menu to determine the "standard size" of the window.
- (NSRect)windowWillUseStandardFrame:(NSWindow*)window
defaultFrame:(NSRect)frame {
if (!shell_->zoom_to_page_width())
if (!shell_->zoom_to_page_width()) {
if (shell_->GetAspectRatio() > 0.0)
shell_->set_default_frame_for_zoom(frame);
return frame;
}
// If the shift key is down, maximize.
if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask)
@ -89,6 +92,9 @@ using FullScreenTransitionState =
// Set the width. Don't touch y or height.
frame.size.width = zoomed_width;
if (shell_->GetAspectRatio() > 0.0)
shell_->set_default_frame_for_zoom(frame);
return frame;
}