diff --git a/modules/desktop_capture/mac/window_list_utils.cc b/modules/desktop_capture/mac/window_list_utils.cc index d2fb20ed4c..5d881662ea 100644 --- a/modules/desktop_capture/mac/window_list_utils.cc +++ b/modules/desktop_capture/mac/window_list_utils.cc @@ -31,6 +31,11 @@ namespace webrtc { namespace { +// WindowName of the status indicator dot shown since Monterey in the taskbar. +// Testing on 12.2.1 shows this is independent of system language setting. +const CFStringRef kStatusIndicator = CFSTR("StatusIndicator"); +const CFStringRef kStatusIndicatorOwnerName = CFSTR("Window Server"); + bool ToUtf8(const CFStringRef str16, std::string* str8) { size_t maxlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(str16), kCFStringEncodingUTF8) + @@ -145,6 +150,17 @@ bool GetWindowList(rtc::FunctionView on_window, continue; } + CFStringRef window_owner_name = reinterpret_cast( + CFDictionaryGetValue(window, kCGWindowOwnerName)); + // Ignore the red dot status indicator shown in the stats bar. Unlike the + // rest of the system UI it has a window_layer of 0, so was otherwise + // included. See crbug.com/1297731. + if (window_title && CFEqual(window_title, kStatusIndicator) && + window_owner_name && + CFEqual(window_owner_name, kStatusIndicatorOwnerName)) { + continue; + } + if (!on_window(window)) { break; }