fix: use setAspectRatio for frameless window on mac (#32287)

* fix(window): setAspectRatio for frameless windows

* dummy

* undo dummy

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
This commit is contained in:
Gellert Hegyi 2022-01-13 01:42:42 +01:00 committed by GitHub
parent 506d82a902
commit f4548985f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1600,11 +1600,16 @@ void NativeWindowMac::SetAspectRatio(double aspect_ratio,
NativeWindow::SetAspectRatio(aspect_ratio, extra_size); NativeWindow::SetAspectRatio(aspect_ratio, extra_size);
// Reset the behaviour to default if aspect_ratio is set to 0 or less. // Reset the behaviour to default if aspect_ratio is set to 0 or less.
if (aspect_ratio > 0.0) if (aspect_ratio > 0.0) {
[window_ setContentAspectRatio:NSMakeSize(aspect_ratio, 1.0)]; NSSize aspect_ratio_size = NSMakeSize(aspect_ratio, 1.0);
if (has_frame())
[window_ setContentAspectRatio:aspect_ratio_size];
else else
[window_ setAspectRatio:aspect_ratio_size];
} else {
[window_ setResizeIncrements:NSMakeSize(1.0, 1.0)]; [window_ setResizeIncrements:NSMakeSize(1.0, 1.0)];
} }
}
void NativeWindowMac::PreviewFile(const std::string& path, void NativeWindowMac::PreviewFile(const std::string& path,
const std::string& display_name) { const std::string& display_name) {