Rename IsWindowMinimized to IsWindowOnScreen
As discussed in change https://chromium-review.googlesource.com/c/external/webrtc/+/634043, the name of IsWindowMinimized() functions is too confusing. IsWindowOnScreen() is preferred, since it describes the behavior of the functions more accurately. This change does not flip the default behavior of these functions to avoid a behavior change. TODO has been added; and the flipping will happen in a following change. Bug: chromium:758554 Change-Id: I009c0fa57142756e5c83f76b2a3561253db1b67f Reviewed-on: https://chromium-review.googlesource.com/641814 Commit-Queue: Zijie He <zijiehe@chromium.org> Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Cr-Commit-Position: refs/heads/master@{#19613}
This commit is contained in:
parent
774115c8c6
commit
f7f685c9de
@ -147,7 +147,7 @@ FullScreenChromeWindowDetector::~FullScreenChromeWindowDetector() {}
|
||||
|
||||
CGWindowID FullScreenChromeWindowDetector::FindFullScreenWindow(
|
||||
CGWindowID original_window) {
|
||||
if (!IsChromeWindow(original_window) || !IsWindowMinimized(original_window))
|
||||
if (!IsChromeWindow(original_window) || IsWindowOnScreen(original_window))
|
||||
return kCGNullWindowID;
|
||||
|
||||
CGWindowID full_screen_window_id =
|
||||
@ -176,7 +176,7 @@ void FullScreenChromeWindowDetector::UpdateWindowListIfNeeded(
|
||||
previous_window_list_.swap(current_window_list_);
|
||||
|
||||
// No need to update the window list when the window is minimized.
|
||||
if (IsWindowMinimized(original_window)) {
|
||||
if (!IsWindowOnScreen(original_window)) {
|
||||
previous_window_list_.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ bool GetWindowList(rtc::FunctionView<bool(CFDictionaryRef)> on_window,
|
||||
}
|
||||
|
||||
// Skip windows that are minimized and not full screen.
|
||||
if (ignore_minimized && IsWindowMinimized(window) &&
|
||||
if (ignore_minimized && !IsWindowOnScreen(window) &&
|
||||
!IsWindowFullScreen(desktop_config, window)) {
|
||||
continue;
|
||||
}
|
||||
@ -138,29 +138,28 @@ bool IsWindowFullScreen(
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
bool IsWindowMinimized(CFDictionaryRef window) {
|
||||
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);
|
||||
}
|
||||
|
||||
// Returns true if the window is minimized.
|
||||
bool IsWindowMinimized(CGWindowID id) {
|
||||
bool IsWindowOnScreen(CGWindowID id) {
|
||||
CFArrayRef window_id_array =
|
||||
CFArrayCreate(NULL, reinterpret_cast<const void **>(&id), 1, NULL);
|
||||
CFArrayRef window_array =
|
||||
CGWindowListCreateDescriptionFromArray(window_id_array);
|
||||
bool minimized = false;
|
||||
bool on_screen = true;
|
||||
|
||||
if (window_array && CFArrayGetCount(window_array)) {
|
||||
minimized = IsWindowMinimized(reinterpret_cast<CFDictionaryRef>(
|
||||
on_screen = IsWindowOnScreen(reinterpret_cast<CFDictionaryRef>(
|
||||
CFArrayGetValueAtIndex(window_array, 0)));
|
||||
}
|
||||
|
||||
CFRelease(window_id_array);
|
||||
CFRelease(window_array);
|
||||
|
||||
return minimized;
|
||||
return on_screen;
|
||||
}
|
||||
|
||||
std::string GetWindowTitle(CFDictionaryRef window) {
|
||||
|
||||
@ -36,11 +36,16 @@ bool GetWindowList(DesktopCapturer::SourceList* windows, bool ignore_minimized);
|
||||
bool IsWindowFullScreen(const MacDesktopConfiguration& desktop_config,
|
||||
CFDictionaryRef window);
|
||||
|
||||
// Returns true if the |window| is minimized.
|
||||
bool IsWindowMinimized(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
|
||||
// native APIs fail.
|
||||
bool IsWindowOnScreen(CFDictionaryRef window);
|
||||
|
||||
// Returns true if the window is minimized.
|
||||
bool IsWindowMinimized(CGWindowID id);
|
||||
// Returns true if the window is on screen. This function returns true 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
|
||||
// valid title can be retrieved, this function returns an empty string.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user