Skip to content

Commit

Permalink
fix: use setAspectRatio for frameless window on mac (#32446)
Browse files Browse the repository at this point in the history
* fix(window): setAspectRatio for frameless windows

* dummy

* undo dummy

Co-authored-by: Gellert Hegyi <gellert.hegyi@around.co>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
  • Loading branch information
3 people committed Jan 13, 2022
1 parent 0b57386 commit b649268
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions shell/browser/native_window_mac.mm
Expand Up @@ -1603,10 +1603,15 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
NativeWindow::SetAspectRatio(aspect_ratio, extra_size);

// Reset the behaviour to default if aspect_ratio is set to 0 or less.
if (aspect_ratio > 0.0)
[window_ setContentAspectRatio:NSMakeSize(aspect_ratio, 1.0)];
else
if (aspect_ratio > 0.0) {
NSSize aspect_ratio_size = NSMakeSize(aspect_ratio, 1.0);
if (has_frame())
[window_ setContentAspectRatio:aspect_ratio_size];
else
[window_ setAspectRatio:aspect_ratio_size];
} else {
[window_ setResizeIncrements:NSMakeSize(1.0, 1.0)];
}
}

void NativeWindowMac::PreviewFile(const std::string& path,
Expand Down

0 comments on commit b649268

Please sign in to comment.