2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
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.
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_
14 #include <ApplicationServices/ApplicationServices.h>
15 #include <Carbon/Carbon.h>
18 #include "webrtc/typedefs.h"
19 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
23 // Describes the configuration of a specific display.
24 struct MacDisplayConfiguration {
25 MacDisplayConfiguration();
27 // Cocoa identifier for this display.
30 // Bounds of this display in Density-Independent Pixels (DIPs).
33 // Bounds of this display in physical pixels.
34 DesktopRect pixel_bounds;
36 // Scale factor from DIPs to physical pixels.
37 float dip_to_pixel_scale;
40 typedef std::vector<MacDisplayConfiguration> MacDisplayConfigurations;
42 // Describes the configuration of the whole desktop.
43 struct MacDesktopConfiguration {
44 // Used to request bottom-up or top-down coordinates.
45 enum Origin { BottomLeftOrigin, TopLeftOrigin };
47 MacDesktopConfiguration();
48 ~MacDesktopConfiguration();
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);
55 // Returns true if the given desktop configuration equals this one.
56 bool Equals(const MacDesktopConfiguration& other);
58 // Returns the pointer to the display configuration with the specified id.
59 const MacDisplayConfiguration* FindDisplayConfigurationById(
60 CGDirectDisplayID id);
62 // Bounds of the desktop in Density-Independent Pixels (DIPs).
65 // Bounds of the desktop in physical pixels.
66 DesktopRect pixel_bounds;
68 // Scale factor from DIPs to physical pixels.
69 float dip_to_pixel_scale;
71 // Configurations of the displays making up the desktop area.
72 MacDisplayConfigurations displays;
77 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_