fix: update normal bounds prior to minimizing (#34473)

This commit is contained in:
Shelley Vohr 2022-06-09 10:48:50 +02:00 committed by GitHub
parent 2fd0194e94
commit 37d93b0482
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 186 additions and 5 deletions

View file

@ -447,7 +447,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
SetContentView(new views::View());
AddContentViewLayers();
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
original_level_ = [window_ level];
}
@ -609,7 +609,7 @@ void NativeWindowMac::Maximize() {
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
[window_ zoom:nil];
if (!is_visible) {
@ -653,7 +653,7 @@ void NativeWindowMac::Minimize() {
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
[window_ miniaturize:nil];
}
@ -697,7 +697,7 @@ void NativeWindowMac::SetFullScreen(bool fullscreen) {
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
// This needs to be set here because it can be the case that
// SetFullScreen is called by a user before windowWillEnterFullScreen
@ -733,6 +733,7 @@ void NativeWindowMac::SetBounds(const gfx::Rect& bounds, bool animate) {
[window_ setFrame:cocoa_bounds display:YES animate:animate];
user_set_bounds_maximized_ = IsMaximized() ? true : false;
UpdateWindowOriginalFrame();
}
gfx::Rect NativeWindowMac::GetBounds() {
@ -1005,7 +1006,7 @@ void NativeWindowMac::SetSimpleFullScreen(bool simple_fullscreen) {
// Take note of the current window size and level
if (IsNormal()) {
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
original_level_ = [window_ level];
}
@ -1402,6 +1403,10 @@ void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
}
}
void NativeWindowMac::UpdateWindowOriginalFrame() {
original_frame_ = [window_ frame];
}
void NativeWindowMac::SetVibrancy(const std::string& type) {
NSVisualEffectView* vibrantView = [window_ vibrantView];