diff --git a/webrtc/modules/desktop_capture/mac/window_list_utils.cc b/webrtc/modules/desktop_capture/mac/window_list_utils.cc index 8b668c9703..10c12c1ce2 100644 --- a/webrtc/modules/desktop_capture/mac/window_list_utils.cc +++ b/webrtc/modules/desktop_capture/mac/window_list_utils.cc @@ -141,7 +141,7 @@ bool IsWindowFullScreen( bool IsWindowOnScreen(CFDictionaryRef window) { CFBooleanRef on_screen = reinterpret_cast( CFDictionaryGetValue(window, kCGWindowIsOnscreen)); - return on_screen == NULL || CFBooleanGetValue(on_screen); + return on_screen != NULL && CFBooleanGetValue(on_screen); } bool IsWindowOnScreen(CGWindowID id) { @@ -149,7 +149,7 @@ bool IsWindowOnScreen(CGWindowID id) { CFArrayCreate(NULL, reinterpret_cast(&id), 1, NULL); CFArrayRef window_array = CGWindowListCreateDescriptionFromArray(window_id_array); - bool on_screen = true; + bool on_screen = false; if (window_array && CFArrayGetCount(window_array)) { on_screen = IsWindowOnScreen(reinterpret_cast( diff --git a/webrtc/modules/desktop_capture/mac/window_list_utils.h b/webrtc/modules/desktop_capture/mac/window_list_utils.h index b4608f6641..5e204a7d20 100644 --- a/webrtc/modules/desktop_capture/mac/window_list_utils.h +++ b/webrtc/modules/desktop_capture/mac/window_list_utils.h @@ -36,15 +36,12 @@ bool GetWindowList(DesktopCapturer::SourceList* windows, bool ignore_minimized); bool IsWindowFullScreen(const MacDesktopConfiguration& desktop_config, CFDictionaryRef window); -// TODO(zijiehe): Flip the behaviors of the following two functions when native -// APIs fail. If |window| does not represent a window, or |id| cannot be found, -// returning false is more reasonable. -// Returns true if the |window| is on screen. This function returns true if +// Returns true if the |window| is on screen. This function returns false if // native APIs fail. bool IsWindowOnScreen(CFDictionaryRef window); -// Returns true if the window is on screen. This function returns true if native -// APIs fail or |id| cannot be found. +// Returns true if the window is on screen. This function returns false if +// native APIs fail or |id| cannot be found. bool IsWindowOnScreen(CGWindowID id); // Returns utf-8 encoded title of |window|. If |window| is not a window or no