feat: make win.setAspectRatio() work on Windows (#26941)

* feat: make win.setAspectRatio() work on Windows

* update patches

Co-authored-by: Electron Bot <electron@github.com>
This commit is contained in:
Cheng Zhao 2021-01-05 17:17:33 +09:00 committed by GitHub
parent 16c864a932
commit 5f99569b6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 5 deletions

View file

@ -755,13 +755,11 @@ bool NativeWindowViews::IsResizable() {
void NativeWindowViews::SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) {
NativeWindow::SetAspectRatio(aspect_ratio, extra_size);
#if defined(OS_LINUX)
gfx::SizeF aspect(aspect_ratio, 1.0);
// Scale up because SetAspectRatio() truncates aspect value to int
aspect.Scale(100);
widget()->SetAspectRatio(aspect);
#endif
}
void NativeWindowViews::SetMovable(bool movable) {