Browse Source

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

trop[bot] 6 years ago
parent
commit
27b4335084
1 changed files with 6 additions and 1 deletions
  1. 6 1
      atom/browser/native_window_mac.mm

+ 6 - 1
atom/browser/native_window_mac.mm

@@ -576,7 +576,12 @@ void NativeWindowMac::Hide() {
 }
 
 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() {