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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2022-06-09 15:39:08 -04:00
committed by GitHub
parent e87d17b728
commit 3cf901e45b
4 changed files with 186 additions and 5 deletions

View File

@@ -166,6 +166,8 @@ class NativeWindowMac : public NativeWindow,
void UpdateVibrancyRadii(bool fullscreen);
void UpdateWindowOriginalFrame();
// Set the attribute of NSWindow while work around a bug of zoom button.
void SetStyleMask(bool on, NSUInteger flag);
void SetCollectionBehavior(bool on, NSUInteger flag);

View File

@@ -451,7 +451,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
SetContentView(new views::View());
AddContentViewLayers();
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
original_level_ = [window_ level];
}
@@ -618,7 +618,7 @@ void NativeWindowMac::Maximize() {
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
[window_ zoom:nil];
if (!is_visible) {
@@ -662,7 +662,7 @@ void NativeWindowMac::Minimize() {
// Take note of the current window size
if (IsNormal())
original_frame_ = [window_ frame];
UpdateWindowOriginalFrame();
[window_ miniaturize:nil];
}
@@ -715,7 +715,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
@@ -751,6 +751,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() {
@@ -1025,7 +1026,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];
}
@@ -1423,6 +1424,10 @@ void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) {
}
}
void NativeWindowMac::UpdateWindowOriginalFrame() {
original_frame_ = [window_ frame];
}
void NativeWindowMac::SetVibrancy(const std::string& type) {
NSVisualEffectView* vibrantView = [window_ vibrantView];

View File

@@ -203,6 +203,7 @@ using FullScreenTransitionState =
// windowDidDeminiaturize
level_ = [window level];
shell_->SetWindowLevel(NSNormalWindowLevel);
shell_->UpdateWindowOriginalFrame();
}
- (void)windowDidMiniaturize:(NSNotification*)notification {