blob: 80a155d8a9d6fbd08215db76a65be4a8e20b3564 [file] [log] [blame]
sergeyu@chromium.org3d34f662013-06-04 18:51:23 +00001/*
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
jiayl@webrtc.orgcf1b51b2014-01-29 21:59:12 +000055 // Returns true if the given desktop configuration equals this one.
56 bool Equals(const MacDesktopConfiguration& other);
57
sergeyu@chromium.org3d34f662013-06-04 18:51:23 +000058 // Bounds of the desktop in Density-Independent Pixels (DIPs).
59 DesktopRect bounds;
60
61 // Bounds of the desktop in physical pixels.
62 DesktopRect pixel_bounds;
63
64 // Scale factor from DIPs to physical pixels.
65 float dip_to_pixel_scale;
66
67 // Configurations of the displays making up the desktop area.
68 MacDisplayConfigurations displays;
69};
70
71} // namespace webrtc
72
73#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_H_