fix: take foreground visibility into account for isVisible on macOS (#17463)

This commit is contained in:
Shelley Vohr 2019-03-20 15:33:59 -07:00 committed by GitHub
parent a82bbd010e
commit b140a82fe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -576,7 +576,12 @@ void NativeWindowMac::Hide() {
} }
bool NativeWindowMac::IsVisible() { bool NativeWindowMac::IsVisible() {
return [window_ isVisible]; bool occluded = [window_ occlusionState] == NSWindowOcclusionStateVisible;
// For a window to be visible, it must be visible to the user in the
// foreground of the app, which means that it should not be minimized or
// occluded
return [window_ isVisible] && !occluded && !IsMinimized();
} }
bool NativeWindowMac::IsEnabled() { bool NativeWindowMac::IsEnabled() {