fix: traffic lights not working when child windows are restored via parent window (#39225)
This commit is contained in:
parent
12548294c0
commit
38c3d8df29
2 changed files with 22 additions and 2 deletions
|
@ -23,6 +23,10 @@ class NativeWindowMac;
|
||||||
int level_;
|
int level_;
|
||||||
bool is_resizable_;
|
bool is_resizable_;
|
||||||
|
|
||||||
|
// Whether the window is currently minimized. Used to work
|
||||||
|
// around a macOS bug with child window minimization.
|
||||||
|
bool is_minimized_;
|
||||||
|
|
||||||
// Only valid during a live resize.
|
// Only valid during a live resize.
|
||||||
// Used to keep track of whether a resize is happening horizontally or
|
// Used to keep track of whether a resize is happening horizontally or
|
||||||
// vertically, even if physically the user is resizing in both directions.
|
// vertically, even if physically the user is resizing in both directions.
|
||||||
|
|
|
@ -55,10 +55,22 @@ using FullScreenTransitionState =
|
||||||
|
|
||||||
// check occlusion binary flag
|
// check occlusion binary flag
|
||||||
if (window.occlusionState & NSWindowOcclusionStateVisible) {
|
if (window.occlusionState & NSWindowOcclusionStateVisible) {
|
||||||
// The app is visible
|
// There's a macOS bug where if a child window is minimized, and then both
|
||||||
|
// windows are restored via activation of the parent window, the child
|
||||||
|
// window is not properly deminiaturized. This causes traffic light bugs
|
||||||
|
// like the close and miniaturize buttons having no effect. We need to call
|
||||||
|
// deminiaturize on the child window to fix this. Unfortunately, this also
|
||||||
|
// hits ANOTHER bug where even after calling deminiaturize,
|
||||||
|
// windowDidDeminiaturize is not posted on the child window if it was
|
||||||
|
// incidentally restored by the parent, so we need to manually reset
|
||||||
|
// is_minimized_ here.
|
||||||
|
if (shell_->parent() && is_minimized_) {
|
||||||
|
shell_->Restore();
|
||||||
|
is_minimized_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
shell_->NotifyWindowShow();
|
shell_->NotifyWindowShow();
|
||||||
} else {
|
} else {
|
||||||
// The app is not visible
|
|
||||||
shell_->NotifyWindowHide();
|
shell_->NotifyWindowHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,11 +260,15 @@ using FullScreenTransitionState =
|
||||||
|
|
||||||
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
||||||
[super windowDidMiniaturize:notification];
|
[super windowDidMiniaturize:notification];
|
||||||
|
is_minimized_ = true;
|
||||||
|
|
||||||
shell_->NotifyWindowMinimize();
|
shell_->NotifyWindowMinimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
||||||
[super windowDidDeminiaturize:notification];
|
[super windowDidDeminiaturize:notification];
|
||||||
|
is_minimized_ = false;
|
||||||
|
|
||||||
shell_->AttachChildren();
|
shell_->AttachChildren();
|
||||||
shell_->SetWindowLevel(level_);
|
shell_->SetWindowLevel(level_);
|
||||||
shell_->NotifyWindowRestore();
|
shell_->NotifyWindowRestore();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue