1/* 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_ 12#define WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_ 13 14#include <ApplicationServices/ApplicationServices.h> 15#include <Carbon/Carbon.h> 16#include <vector> 17 18#include "webrtc/typedefs.h" 19#include "webrtc/modules/desktop_capture/desktop_geometry.h" 20 21namespace webrtc { 22 23// Describes the configuration of a specific display. 24struct MacDisplayConfiguration { 25 MacDisplayConfiguration(); 26 27 // Cocoa identifier for this display. 28 CGDirectDisplayID id; 29 30 // Bounds of this display in Density-Independent Pixels (DIPs). 31 DesktopRect bounds; 32 33 // Bounds of this display in physical pixels. 34 DesktopRect pixel_bounds; 35 36 // Scale factor from DIPs to physical pixels. 37 float dip_to_pixel_scale; 38}; 39 40typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations; 41 42// Describes the configuration of the whole desktop. 43struct MacDesktopConfiguration { 44 // Used to request bottom-up or top-down coordinates. 45 enum Origin { BottomLeftOrigin, TopLeftOrigin }; 46 47 MacDesktopConfiguration(); 48 ~MacDesktopConfiguration(); 49 50 // Returns the desktop & display configurations in Cocoa-style "bottom-up" 51 // (the origin is the bottom-left of the primary monitor, and coordinates 52 // increase as you move up the screen) or Carbon-style "top-down" coordinates. 53 static MacDesktopConfiguration GetCurrent(Origin origin); 54 55 // Returns true if the given desktop configuration equals this one. 56 bool Equals(const MacDesktopConfiguration& other); 57 58 // Returns the pointer to the display configuration with the specified id. 59 const MacDisplayConfiguration* FindDisplayConfigurationById( 60 CGDirectDisplayID id); 61 62 // Bounds of the desktop excluding monitors with DPI settings different from 63 // the main monitor. In Density-Independent Pixels (DIPs). 64 DesktopRect bounds; 65 66 // Same as bounds, but expressed in physical pixels. 67 DesktopRect pixel_bounds; 68 69 // Scale factor from DIPs to physical pixels. 70 float dip_to_pixel_scale; 71 72 // Configurations of the displays making up the desktop area. 73 MacDisplayConfigurations displays; 74}; 75 76} // namespace webrtc 77 78#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_ 79