Index: webrtc/modules/desktop_capture/mac/window_list_utils.cc |
diff --git a/webrtc/modules/desktop_capture/mac/window_list_utils.cc b/webrtc/modules/desktop_capture/mac/window_list_utils.cc |
index 0c3eaa3abd55fb4076b705eded33c8d55c2fce6d..0261c45a69d35f6f011f6ad4286ffae11b183a4b 100644 |
--- a/webrtc/modules/desktop_capture/mac/window_list_utils.cc |
+++ b/webrtc/modules/desktop_capture/mac/window_list_utils.cc |
@@ -59,4 +59,56 @@ bool GetWindowList(WindowCapturer::WindowList* windows) { |
return true; |
} |
+// Returns true if the window is occupying a full screen. |
+bool IsWindowFullScreen( |
+ const MacDesktopConfiguration& desktop_config, |
+ CFDictionaryRef window) { |
+ bool fullscreen = false; |
+ CFDictionaryRef bounds_ref = reinterpret_cast<CFDictionaryRef>( |
+ CFDictionaryGetValue(window, kCGWindowBounds)); |
+ |
+ CGRect bounds; |
+ if (bounds_ref && |
+ CGRectMakeWithDictionaryRepresentation(bounds_ref, &bounds)) { |
+ for (MacDisplayConfigurations::const_iterator it = |
+ desktop_config.displays.begin(); |
+ it != desktop_config.displays.end(); ++it) { |
+ if (it->bounds.equals(DesktopRect::MakeXYWH(bounds.origin.x, |
+ bounds.origin.y, |
+ bounds.size.width, |
+ bounds.size.height))) { |
+ fullscreen = true; |
+ break; |
+ } |
+ } |
+ } |
+ |
+ return fullscreen; |
+} |
+ |
+// Returns true if the window is minimized. |
+bool IsWindowMinimized(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; |
+ |
+ if (window_array && CFArrayGetCount(window_array)) { |
+ CFDictionaryRef window = reinterpret_cast<CFDictionaryRef>( |
+ CFArrayGetValueAtIndex(window_array, 0)); |
+ CFBooleanRef on_screen = reinterpret_cast<CFBooleanRef>( |
+ CFDictionaryGetValue(window, kCGWindowIsOnscreen)); |
+ |
+ minimized = !on_screen; |
+ } |
+ |
+ CFRelease(window_id_array); |
+ CFRelease(window_array); |
+ |
+ return minimized; |
+} |
+ |
+ |
+ |
} // namespace webrtc |