Flip IsWindowOnScreen behavior when native APIs fail
Per discussion in https://chromium-review.googlesource.com/c/external/webrtc/+/641814, the behavior of IsWindowOnScreen() functions when native APIs fail should be flipped. I.e. window is *not* on screen if OS cannot find it. Bug: chromium:758554 Change-Id: Ife449a5261fcd89c37595e29a0b1802fcf3c42a5 Reviewed-on: https://chromium-review.googlesource.com/644290 Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Commit-Queue: Zijie He <zijiehe@chromium.org> Cr-Commit-Position: refs/heads/master@{#19617}
This commit is contained in:
parent
6d648927ac
commit
3aa4afd630
@ -141,7 +141,7 @@ bool IsWindowFullScreen(
|
||||
bool IsWindowOnScreen(CFDictionaryRef window) {
|
||||
CFBooleanRef on_screen = reinterpret_cast<CFBooleanRef>(
|
||||
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<const void **>(&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<CFDictionaryRef>(
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user